mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
reconnector: disconnect if connected.
This commit is contained in:
parent
9f13d43da5
commit
b881a52fbb
@ -33,6 +33,10 @@ export class WebrtcReconnector extends ReconnectorAbstract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public connect() {
|
public connect() {
|
||||||
|
if (this._webrtc.connected) {
|
||||||
|
this._webrtc.disconnect()
|
||||||
|
}
|
||||||
|
|
||||||
if (this._websocket.connected) {
|
if (this._websocket.connected) {
|
||||||
this._websocket.send(EVENT.SIGNAL_REQUEST, { video: this._state.webrtc.video })
|
this._websocket.send(EVENT.SIGNAL_REQUEST, { video: this._state.webrtc.video })
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,10 @@ export class WebsocketReconnector extends ReconnectorAbstract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public connect() {
|
public connect() {
|
||||||
|
if (this._websocket.connected) {
|
||||||
|
this._websocket.disconnect()
|
||||||
|
}
|
||||||
|
|
||||||
let url = this._state.url
|
let url = this._state.url
|
||||||
url = url.replace(/^http/, 'ws').replace(/\/+$/, '') + '/api/ws'
|
url = url.replace(/^http/, 'ws').replace(/\/+$/, '') + '/api/ws'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user