unity-websocket-webgl icon indicating copy to clipboard operation
unity-websocket-webgl copied to clipboard

Uncaught exception when WebSocketSend called after WS closed

Open austinkelleher opened this issue 5 years ago • 1 comments

An uncaught exception will occur if WebSocketSend is called after the ws property on the instance has already been deleted here: https://github.com/jirihybek/unity-websocket-webgl/blob/master/Plugins/WebSocket.jslib#L205

Uncaught TypeError: Cannot read property 'readyState' of undefined

This is because the WebSocketSend method only checks for null, but in this case the value would be undefined here: https://github.com/jirihybek/unity-websocket-webgl/blob/master/Plugins/WebSocket.jslib#L258

I will have a PR with the fix momentarily.

austinkelleher avatar Feb 16 '19 16:02 austinkelleher

This PR fixed my problem. Thank you very much.

XtroTheArctic avatar Apr 14 '21 16:04 XtroTheArctic