colyseus.js icon indicating copy to clipboard operation
colyseus.js copied to clipboard

WebSocket onError handler incorrectly accepts a CloseEvent

Open ShukantPal opened this issue 2 years ago • 0 comments

I found a log in our application from Colyseus.js:

Room, onError (undefined): undefined

That's coming from here: https://github.com/colyseus/colyseus.js/blob/2feff0ae5efa139e9fcf0af370852c418f7b2ce0/src/Room.ts#L76

The onerror event handler is incorrectly assuming that the WebSocket will pass a CloseEvent. A plain Event is passed instead. See the WebSocket API's error event has no specific type, while the WebSocket API's close event does.

ShukantPal avatar Mar 26 '22 21:03 ShukantPal