temporary client compatibility workaround.

This commit is contained in:
Miroslav Šedivý 2021-09-09 00:15:36 +02:00
parent 96b6d8fa8d
commit 0142b8066d

View File

@ -72,11 +72,12 @@ export class NekoWebSocket extends EventEmitter<NekoWebSocketEvents> {
} }
this._log.debug(`sending event '${event}' ${payload ? `with payload: ` : ''}`, payload) this._log.debug(`sending event '${event}' ${payload ? `with payload: ` : ''}`, payload)
this._ws!.send(JSON.stringify({ event, payload })) this._ws!.send(JSON.stringify({ event, payload, ...payload }))
} }
private onMessage(e: MessageEvent) { private onMessage(e: MessageEvent) {
const { event, payload } = JSON.parse(e.data) const { event, ...data } = JSON.parse(e.data)
const payload = 'payload' in data ? data.payload : data
this._log.debug(`received websocket event ${event} ${payload ? `with payload: ` : ''}`, payload) this._log.debug(`received websocket event ${event} ${payload ? `with payload: ` : ''}`, payload)
this.emit('message', event, payload) this.emit('message', event, payload)