mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
webrtc send: check only data channel availability.
This commit is contained in:
parent
f536552377
commit
45e8ad19a9
@ -328,8 +328,8 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
|
|||||||
public send(event: 'wheel' | 'mousemove', data: { x: number; y: number }): void
|
public send(event: 'wheel' | 'mousemove', data: { x: number; y: number }): void
|
||||||
public send(event: 'mousedown' | 'mouseup' | 'keydown' | 'keyup', data: { key: number }): void
|
public send(event: 'mousedown' | 'mouseup' | 'keydown' | 'keyup', data: { key: number }): void
|
||||||
public send(event: string, data: any): void {
|
public send(event: string, data: any): void {
|
||||||
if (!this.connected) {
|
if (typeof this._channel === 'undefined' || this._channel.readyState !== 'open') {
|
||||||
this._log.warn(`attempting to send data while disconnected`, { event })
|
this._log.warn(`attempting to send data, but data-channel is not open`, { event })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this._channel!.send(buffer)
|
this._channel.send(buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
private onTrack(event: RTCTrackEvent) {
|
private onTrack(event: RTCTrackEvent) {
|
||||||
|
Loading…
Reference in New Issue
Block a user