WebSockets: throw error if trying to send() before open() in MessageChannel
This commit is contained in:
parent
7aca159017
commit
bfcba85336
@ -61,7 +61,11 @@ export class MessageChannel {
|
||||
}
|
||||
|
||||
send (msg) {
|
||||
if (this.socket) {
|
||||
this.socket.send(msg.toJsonText());
|
||||
} else {
|
||||
throw Error('MessageChannel: cannot call send() before open()');
|
||||
}
|
||||
}
|
||||
|
||||
closeCallback () {
|
||||
|
Loading…
Reference in New Issue
Block a user