mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
temporary client compatibility workaround.
This commit is contained in:
parent
96b6d8fa8d
commit
0142b8066d
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user