Error Establishing WebSocket Connection


I’m facing an issue while trying to establish a WebSocket connection to my Mattermost server and need assistance in troubleshooting.

When trying to connect to the Mattermost server using WebSocket, I’m receiving an error message stating: “WebSocket connection failed: Connection refused.”

I’m using Mattermost version 5.38.1 on my server, and I’ve verified that the server is running without any errors. Despite all this I’m unable to establish a WebSocket connection from my client application. I’ve checked the WebSocket configuration in Mattermost and confirmed that it is enabled.

I’ve checked the network configuration to ensure that the server’s WebSocket port (usually 443) is open and accessible. I’ve also verified that there are no firewall rules blocking WebSocket connections. I’ve reviewed the Mattermost server logs for any relevant error messages, but I haven’t found any solution to the issue. Troubleshooting - Mattermost Discussion Forums info

I need help on how to further troubleshoot and resolve this WebSocket connection error in Mattermost. Any suggestions would be greatly appreciated.

Thank you for your help!

Thank you

1 Like

same issue

  • windows 11
  • desktop 5.7.0
  • server 9.7.1

At some point, the error occurs, whereas before it didn’t.

@stevediaz 5.38 is ANCIENT! Went out of support two and a half years ago! Take a look at Release Lifecycle - Mattermost documentation and Version Archive - Mattermost documentation

Upgrade Mattermost Server - Mattermost documentation will walk you through upgrading. Generally speaking, you want to get to the next ESR (6.3) and then hop ESR to ESR.

As for Websockets… it is fairly common to see issues like this when some piece of the network (firewalls, load balancers, security groups, anything between the client and server) “secures” 80/TCP and 443/TCP to HTTP/HTTPS but not WS/WSS. WebSocket is a different protocol that happens to use the same ports as HTTP/HTTPS.

If you were at about 7.10 I’d point you to Integrations configuration settings - Mattermost documentation as we began enforcing a restriction around cross-orifin requests then.

If at all possible, start testing with a client on the same VLAN as the server with nothing in between.

You can also Ctrl-Shift-J to open the Javascript console in your browser, test the connection, and see what it says. I’m not a developer so much of that is Greek to me, but if you can get some errors that way, I might have an a-ha moment or be able to ask someone smarter than me.