minor WS &WebRTC fixes.

This commit is contained in:
Miroslav Šedivý 2021-02-08 18:46:07 +01:00
parent b6d61c0748
commit 85a3f4fd9d
2 changed files with 5 additions and 6 deletions

View File

@ -207,13 +207,11 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
break break
default: default:
this._log.warn(`unknown data event: ${event}`) this._log.warn(`unknown data event: ${event}`)
return
} }
// @ts-ignore
if (typeof buffer !== 'undefined') {
this._channel!.send(buffer) this._channel!.send(buffer)
} }
}
// not-implemented // not-implemented
private onData(e: MessageEvent) {} private onData(e: MessageEvent) {}
@ -250,6 +248,7 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
if (this._statsStop && typeof this._statsStop === 'function') { if (this._statsStop && typeof this._statsStop === 'function') {
this._statsStop() this._statsStop()
this._statsStop = undefined
} }
} }

View File

@ -203,7 +203,7 @@
throw new Error('client not connected to websocket') throw new Error('client not connected to websocket')
} }
this.websocket.disconnect() this.websocket.disconnect(new Error('manual action'))
} }
public webrtcConnect() { public webrtcConnect() {
@ -361,7 +361,7 @@
this.webrtc.disconnect() this.webrtc.disconnect()
this.clearState() this.clearState()
// reconnect WebRTC // reconnect Websocket
if (this.authenticated) { if (this.authenticated) {
setTimeout(() => { setTimeout(() => {
try { try {