summaryrefslogtreecommitdiff
path: root/share/web_surfaces/shared/channel.js
diff options
context:
space:
mode:
Diffstat (limited to 'share/web_surfaces/shared/channel.js')
-rw-r--r--share/web_surfaces/shared/channel.js22
1 files changed, 7 insertions, 15 deletions
diff --git a/share/web_surfaces/shared/channel.js b/share/web_surfaces/shared/channel.js
index bb67c3bec4..bc5ce704c5 100644
--- a/share/web_surfaces/shared/channel.js
+++ b/share/web_surfaces/shared/channel.js
@@ -29,19 +29,19 @@ export class MessageChannel {
return new Promise((resolve, reject) => {
this._socket = new WebSocket(`ws://${this._host}`);
- this._socket.onclose = () => this.closeCallback();
+ this._socket.onclose = () => this.onClose();
- this._socket.onerror = (error) => this.errorCallback(error);
+ this._socket.onerror = (error) => this.onError(error);
this._socket.onmessage = (event) => {
- this.messageCallback (Message.fromJsonText(event.data));
+ this.onMessage (Message.fromJsonText(event.data));
};
this._socket.onopen = resolve;
});
}
- async close () {
+ close () {
this._socket.close();
}
@@ -53,16 +53,8 @@ export class MessageChannel {
}
}
- closeCallback () {
- // empty
- }
-
- errorCallback (error) {
- // empty
- }
-
- messageCallback (msg) {
- // empty
- }
+ onClose () {}
+ onError (error) {}
+ onMessage (msg) {}
}