client lint fix.
This commit is contained in:
parent
3160382015
commit
3dd48c91ac
@ -62,8 +62,8 @@ export abstract class BaseClient extends EventEmitter<BaseEvents> {
|
|||||||
this._ws = new WebSocket(`${url}ws?password=${password}`)
|
this._ws = new WebSocket(`${url}ws?password=${password}`)
|
||||||
this.emit('debug', `connecting to ${this._ws.url}`)
|
this.emit('debug', `connecting to ${this._ws.url}`)
|
||||||
this._ws.onmessage = this.onMessage.bind(this)
|
this._ws.onmessage = this.onMessage.bind(this)
|
||||||
this._ws.onerror = event => this.onError.bind(this)
|
this._ws.onerror = (event) => this.onError.bind(this)
|
||||||
this._ws.onclose = event => this.onDisconnected.bind(this, new Error('websocket closed'))
|
this._ws.onclose = (event) => this.onDisconnected.bind(this, new Error('websocket closed'))
|
||||||
this._timeout = setTimeout(this.onTimeout.bind(this), 15000)
|
this._timeout = setTimeout(this.onTimeout.bind(this), 15000)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.onDisconnected(err)
|
this.onDisconnected(err)
|
||||||
@ -179,15 +179,15 @@ export abstract class BaseClient extends EventEmitter<BaseEvents> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
this._peer.onconnectionstatechange = event => {
|
this._peer.onconnectionstatechange = (event) => {
|
||||||
this.emit('debug', `peer connection state changed`, this._peer ? this._peer.connectionState : undefined)
|
this.emit('debug', `peer connection state changed`, this._peer ? this._peer.connectionState : undefined)
|
||||||
}
|
}
|
||||||
|
|
||||||
this._peer.onsignalingstatechange = event => {
|
this._peer.onsignalingstatechange = (event) => {
|
||||||
this.emit('debug', `peer signaling state changed`, this._peer ? this._peer.signalingState : undefined)
|
this.emit('debug', `peer signaling state changed`, this._peer ? this._peer.signalingState : undefined)
|
||||||
}
|
}
|
||||||
|
|
||||||
this._peer.oniceconnectionstatechange = event => {
|
this._peer.oniceconnectionstatechange = (event) => {
|
||||||
this._state = this._peer!.iceConnectionState
|
this._state = this._peer!.iceConnectionState
|
||||||
|
|
||||||
this.emit('debug', `peer ice connection state changed: ${this._peer!.iceConnectionState}`)
|
this.emit('debug', `peer ice connection state changed: ${this._peer!.iceConnectionState}`)
|
||||||
@ -222,7 +222,7 @@ export abstract class BaseClient extends EventEmitter<BaseEvents> {
|
|||||||
this._peer.setRemoteDescription({ type: 'offer', sdp })
|
this._peer.setRemoteDescription({ type: 'offer', sdp })
|
||||||
this._peer
|
this._peer
|
||||||
.createAnswer()
|
.createAnswer()
|
||||||
.then(d => {
|
.then((d) => {
|
||||||
this._peer!.setLocalDescription(d)
|
this._peer!.setLocalDescription(d)
|
||||||
this._ws!.send(
|
this._ws!.send(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
@ -232,7 +232,7 @@ export abstract class BaseClient extends EventEmitter<BaseEvents> {
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.catch(err => this.emit('error', err))
|
.catch((err) => this.emit('error', err))
|
||||||
}
|
}
|
||||||
|
|
||||||
private onMessage(e: MessageEvent) {
|
private onMessage(e: MessageEvent) {
|
||||||
@ -246,16 +246,14 @@ export abstract class BaseClient extends EventEmitter<BaseEvents> {
|
|||||||
this.createPeer(sdp, lite, ice)
|
this.createPeer(sdp, lite, ice)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event === EVENT.SIGNAL.CANDIDATE) {
|
if (event === EVENT.SIGNAL.CANDIDATE) {
|
||||||
const { data } = payload as SignalCandidatePayload
|
const { data } = payload as SignalCandidatePayload
|
||||||
let candidate: RTCIceCandidate = JSON.parse(data)
|
let candidate: RTCIceCandidate = JSON.parse(data)
|
||||||
this._peer!.addIceCandidate(candidate)
|
this._peer!.addIceCandidate(candidate)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (typeof this[event] === 'function') {
|
if (typeof this[event] === 'function') {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
Reference in New Issue
Block a user