13
0

WebSockets: re-add close callback in channel.js

This commit is contained in:
Luciano Iam 2020-04-11 17:45:52 +02:00 committed by Robin Gareus
parent ece0bcde8b
commit 02cdd5b52d
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -28,12 +28,17 @@ export class Channel {
open () {
return new Promise((resolve, reject) => {
this.socket = new WebSocket(`ws://${this.host}`);
this.socket.onclose = () => this.closeCallback();
this.socket.onerror = (error) => this.errorCallback(error);
this.socket.onmessage = (event) => this._onMessage(event);
this.socket.onopen = resolve;
});
}
closeCallback () {
// empty
}
errorCallback (error) {
// empty
}