- Only sockets on the page’s web server can be called.
- Communication goes through the web server socket.
- Both server and browser must support it.
The application on the server that wishes to communicate through the WebSocket opens a regular TCP socket. Then there is a handshake procedure that must be followed before data can be sent and received.
I tried to use WebSockets myself without the aid of libraries. Unfortunately, this turned out to be harder than expected. I wrote a Perl script to act as the server side. This would receive the headers from the client and the client would also react to me closing the socket on the server. However, I did not manage to properly shake hands with the client and no data could be sent. Currently I feel it’s not worth the effort to dig deeper.