WebSocket issues

I’m building a chat plugin using WebSockets with @mightyalex and we’re seeing some issues with the WebSocket layer:

  1. When the server closes the connection, the onclose or onerror listeners are not called. They are inconsistently fired immediately after a message is sent. Interestingly, the events are fired if the computer loses internet connectivity.
  2. We’re still debugging the root cause, but it might be the case that XD freezes some time after the connection has been terminated by the server. (Observed on Mac.)

Anyone available from the dev team to help us understand the onclose behavior and potential workarounds?