m-lab / ndt7-js

Apache License 2.0
22 stars 17 forks source link

Fix postMessage calls in case of errors #61

Closed robertodauria closed 2 years ago

robertodauria commented 2 years ago

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".


This change is Reviewable