Answer the question
In order to leave comments, you need to log in
Websocket stopped working after switching to HTTPS. What to change?
There is a service written in Go. An Http server on port 8090 has been raised on it, and a socket has also been raised there.
There is a Php application that listens for events on this socket. All this goodness is on the same server, the application accesses the service through JS like this:
conn = new WebSocket("ws://192.168.1.20:8090/events");
Answer the question
In order to leave comments, you need to log in
Thanks for the advice, the solution was as follows:
1. In GO we connect the same SSL certificates that are used for Https for the application
2. We check that the service is available on the https://mysite.ru:8090
domain
3. We change the connection address to the sockets in the application from ws://192.168.1.20:8090/events to wss://mysite.ru:8090/events , since we have a certificate for the mysite domain.
4. We check - everything works!
The nuance is that now the data transfer occurs with very large delays. This is probably due to the connection being established via Https.
Did you enable SSL support for websockets on the server, or did you just change the prefix in the line?
On your question, it is not clear who is listening to the socket - go or php. I understand that all the same go, configure wss in the same way as https, if https works without problems for you, then there should be no problems with wss
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question