WebSocket closed before the connection is established

I’m following the quickstart guide and when I try to run and test it I get this error:
convergence.esm.js:863 WebSocket connection to ‘ws://localhost:8000/api/realtime/convergence/default’ failed: WebSocket is closed before the connection is established.

what am I missing?

Do you have the container running? Are you able to log in to the admin console?

yes, the container is running and I was able to login to the admin console

Gotcha. What operating system are you using. And if not linux, how are you running docker? When you log into the admin console do you connect to localhost?

same issue here. A reboot of chrome clean the issue, but it doesn’t happen with my other websocket connexion and often happen with convergence.

I’m able to log in to the admin console but can’t load a domain since it’s based on WS.

Using docker and https://github.com/convergencelabs/convergence-deployment on a Debian 10.
Using haproxy as load balancer and for ssl validations.

Thats the nginx config for the socket:

location /realtime/ {
  proxy_pass http://server:8080/;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "upgrade";
  proxy_set_header X-Forwarded-For $remote_addr;
  proxy_read_timeout 60m;
  proxy_send_timeout 60m;

I have no specific log in any container on my latest test, but I have some handshake error on the server 2 hours ago (when I started to work on):

15:33:57 ERROR ClientActor - DomainId(***,******): Invalid message. an unexpected messages was received while authenticating: ‘RequestReceived(HandshakeRequestMessage(false,None,JavaScript,1.0.0-rc.7,UnknownFieldSet(Map())),com.convergencelabs.conve[email protected]4af20793)’

15:33:59 ERROR ClientActor - DomainId(***,******): Invalid message. an unexpected messages was received while authenticating: ‘RequestReceived(HandshakeRequestMessage(false,None,JavaScript,1.0.0-rc.7,UnknownFieldSet(Map())),com.convergencelabs.conve[email protected]620169ac)’

15:38:28 ERROR ClientActor - DomainId(***,******): Invalid message. A handshake message was received while already authenticated: ‘HandshakeRequestMessage(false,None,JavaScript,1.0.0-rc.7,UnknownFieldSet(Map()))’

This might be happening after a hibernation.


UPDATE: I think it’s caused by a timeout in the JavaScript SDK (after hibernation, WS connexion take a lot more time to recover on all my web sockets server, and convergence WS timeout before my other working WS responds). Trying to adjust timeout and handshakeTimeout on the options of the connexion, but nothing change.

Greetings. In the latest release we simplified the connection protocol. I am wondering if that might help resolve the issue. We have gotten reports that when the workstation goes to sleep / hibernation, that there are some errors when reconnecting. We will try testing this out for the next releas.

Hi Michael,

since the upgrade to rc9, i’m facing new issues…
I can log in normally (using jwt), but I’m directly disconnected the seconds after.

Using JS client rc 7, 8 or 9, I got this error message
Handshake failed ConvergenceError: A request timeout occurred.

Using latest JS client rc 12, I don’t get any error but I’m disconnected a second after (receiving an offline event).

Through server, I got this message for both case (js client rc7 and 12):
ClientActor - DomainId(****,****: Invalid message. Could not deserialize binary protocol message: ''

I think I got a issue while parsing protobuff messages, but I can not get why …
The latest sended message is a correct parsable protobuff looking this :

It look like the first field is empty, so maybe it’s why I got this error message.

Everything is working using the console.
I got some issue while upgrading from rc8 to rc9, so I started again from a clean new installation (no upgrade).

Any help is welcome :slightly_smiling_face:

I would be happy to discuss this issue with you on slack if I can join you (cf Unable To Join Slack).



mybad, I just understood that the last release server was rc12 (I trusted the blog too much) and that was necessary to use the same version for the client JS. It seems to work fine with the rc12.

However, I will always enjoy to join you on slack.


UPDATE: if i create a new model using rest api, and after edit it with js client, the client is comiting edits but the model doesn’t change (only the version is incremented). If i open the model with the console, it make it working. If a create a model through the client, it works. But using rest api, the model seem to be broken as to update is really saved.
I will try to create a small sample test soonly. Maybe it’s similare to https://github.com/convergencelabs/convergence-project/issues/189