WebSockets: re-add close callback in channel.js
This commit is contained in:
parent
ece0bcde8b
commit
02cdd5b52d
@ -28,11 +28,16 @@ export class Channel {
|
|||||||
open () {
|
open () {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.socket = new WebSocket(`ws://${this.host}`);
|
this.socket = new WebSocket(`ws://${this.host}`);
|
||||||
|
this.socket.onclose = () => this.closeCallback();
|
||||||
this.socket.onerror = (error) => this.errorCallback(error);
|
this.socket.onerror = (error) => this.errorCallback(error);
|
||||||
this.socket.onmessage = (event) => this._onMessage(event);
|
this.socket.onmessage = (event) => this._onMessage(event);
|
||||||
this.socket.onopen = resolve;
|
this.socket.onopen = resolve;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closeCallback () {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
errorCallback (error) {
|
errorCallback (error) {
|
||||||
// empty
|
// empty
|
||||||
|
Loading…
Reference in New Issue
Block a user