summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/web_surfaces/shared/channel.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/share/web_surfaces/shared/channel.js b/share/web_surfaces/shared/channel.js
index ae02aad8bd..99a80fd354 100644
--- a/share/web_surfaces/shared/channel.js
+++ b/share/web_surfaces/shared/channel.js
@@ -61,7 +61,11 @@ export class MessageChannel {
}
send (msg) {
- this.socket.send(msg.toJsonText());
+ if (this.socket) {
+ this.socket.send(msg.toJsonText());
+ } else {
+ throw Error('MessageChannel: cannot call send() before open()');
+ }
}
closeCallback () {