mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Require handleMessage to be set before opening scratch-link-socket
This commit is contained in:
parent
5e626eb7e9
commit
94afd58b2f
1 changed files with 2 additions and 2 deletions
|
@ -33,12 +33,12 @@ class ScratchLinkWebSocket {
|
||||||
throw new Error(`Unknown ScratchLink socket Type: ${this._type}`);
|
throw new Error(`Unknown ScratchLink socket Type: ${this._type}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._onOpen && this._onClose && this._onError) {
|
if (this._onOpen && this._onClose && this._onError && this._handleMessage) {
|
||||||
this._ws.onopen = this._onOpen;
|
this._ws.onopen = this._onOpen;
|
||||||
this._ws.onclose = this._onClose;
|
this._ws.onclose = this._onClose;
|
||||||
this._ws.onerror = this._onError;
|
this._ws.onerror = this._onError;
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Must set open, close and error handlers before calling open on the socket');
|
throw new Error('Must set open, close, message and error handlers before calling open on the socket');
|
||||||
}
|
}
|
||||||
|
|
||||||
this._ws.onmessage = this._onMessage.bind(this);
|
this._ws.onmessage = this._onMessage.bind(this);
|
||||||
|
|
Loading…
Reference in a new issue