I am trying to learn more about websocket and its internal implementations. But still can not understand a few things. I tried a google search for a detailed explanation, but most of them just provide a high-level overview. Below are my doubts.
1. According to what I read, the web socket server (C # / C ++ implementation) uses port 80 by default. Although we can use any port, it prefers to use port 80 because we are used to having problems with the firewall . If so, how should we start the web server and web socket server on the same port (80)?
2. Assume that the web socket server is running on port 81, and the web server is running on port 80.
So, when the browser sends the original request for the HTTP request (Upgrade: websocket), this request is sent to port 81. Is this correct? If so, this request (see below) has nothing to do with the HTTP protocol. But still, we use the headers of the HTTP protocol. Why?
GET /mychat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw== Sec-WebSocket-Protocol: chat Sec-WebSocket-Version: 13 Origin: http://example.com
Why do they use the same websocket interface, which is currently implemented in most browsers, to directly connect TCP / IP to this port without any HTTP materials?
3. Is there a limit on packet size or a data / buffer limit on data sent / received from the client / server? If so, do we need to create data and process it ourselves?
4. Should the websocket server always be a separate service / process? In the future, web servers (IIS, apache) will include support for hosting web socket servers within their process space?
Sysadmin
source share