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 Forumsinfo
I need help on how to further troubleshoot and resolve this WebSocket connection error in Mattermost. Any suggestions would be greatly appreciated.
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 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.