I updated to the latest version this week and got a Connection lost error in the interface and pushConnection.ts:96 WebSocket connection to 'wss://n8n.xxx.xx/rest/push?sessionId=xxxxx' failed in the console.
I tried the recommendations from other topics where a similar problem was discussed, but they did not lead to anything. I pointed the domain to the server directly and through Cloudflare, the result is the same. I did not configure anything except nginx and pm2, the server is almost bare.
Also tried to reconfigure the server. I’ve tried DigitalOcean, Hetzner, and separately setting up Docker-Compose from scratch from the documentation. All options lead to the following problem:
Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/root/n8n-docker-caddy/caddy_config/Caddyfile" to rootfs at "/etc/caddy/Caddyfile": mount /root/n8n-docker-caddy/caddy_config/Caddyfile:/etc/caddy/Caddyfile (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown : Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
And advice from the forum also did not give results.
I ended up going back to my pm2 and nginx option - the one listed as my configuration below. I set up a brand new server following the instructions here: https://blog.n8n.io/how-to-set-up-n8n-via-pm2/. And got the same Connection lost error unfortunately. But I went back to N8N_PUSH_BACKEND=sse, which seems to suit me.
Finally my questions.
Is there a technical advantage to WebSockets? In speed or load on the server?
Is there a plan to deprecate server-sent events in the future and keep only WebSockets?
Is there an up-to-date setup manual that eradicates the problems described above? What can I try now to enable WebSockets?
The Caddy error you have looks like an issue in the config although I ran through that setup guide this morning and it is working so I expect it was just the data path that needs correcting.
To answer your questions…
WebSockets allow us to support more deployment types and are generally considered to be better.
WebSockets is the default now and SSE will likely be removed in the future
Any of our deployment guides will work, In your case though if you are using nginx the issue will likely be with your nginx configuration. I use nginx for 2 of my personal installations and it is working without issue, You could however see extra issues if you are also using Cloudflare to cache so it depends on if you see the connection lost error all the time or just occasionally.
We don’t really support pm2 officially so the post has not been updated for a while, I will make a note to see if we plan to do anything with pm2 properly but I think docker is our preferred method as there are no extra things to install.