I'm using JavaScript and the Union platform How would I go about diagnosing this problem? Many thanks.
In this code what it means is that ws. close() was called (by user code) before the connection was even given a chance to be established. So, the cause of this error is if code attempts to close the WebSocket connection before it's had a chance to actually connect.
Parameters. An integer WebSocket connection close code value indicating a reason for closure: If unspecified, a close code for the connection is automatically set: to 1000 for a normal closure, or otherwise to another standard value in the range 1001 - 1015 that indicates the actual reason the connection was closed.
To open a websocket connection, we need to create new WebSocket using the special protocol ws in the url: let socket = new WebSocket("ws://javascript.info"); There's also encrypted wss:// protocol. It's like HTTPS for websockets.
If you go to http://jsbin.com/ekusep/6/edit and view the JavaScript console you'll see the 'WebSocket is closed before the connection is established' logged. I've tested this in Chrome.
In this code what it means is that ws.close()
was called (by user code) before the connection was even given a chance to be established.
So, the cause of this error is if code attempts to close the WebSocket connection before it's had a chance to actually connect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With