An Event has methods and cannot be serialized, thus this code caused a cryptic DataCloneError when calling sock.onerror()
Please note that WebSocket errors don't contain any reason for the error, and the actual error (e.g. "Connection failed") is only shown on the JavaScript console. This is intended as a security measure. ev.type is generally just "error".
An Event has methods and cannot be serialized, thus this code caused a cryptic
DataCloneError
when callingsock.onerror()
Please note that WebSocket errors don't contain any reason for the error, and the actual error (e.g. "Connection failed") is only shown on the JavaScript console. This is intended as a security measure.
ev.type
is generally just "error".This change is