Web Server: HTTP and WebSocket on the same port

  1. My goal is: Use the mongoose web server correctly.
  2. My (limited) knowledge is:
    • I know that in general it is possible for a web client to open a HTTP connection and a WebSocket connection on the same port (although some restrictions are imposed on the server side.
    • I know that after a HTTP response is sent from the server, the connection needs to be closed.
    • I know that for a WebSocket connection, the server must not close the connection.
  3. My expectation & question is: If my mongoose web server’s handler receives a HTTP request, processes it and sends back a HTTP response, it should close the connection. But what if there is a WebSocket connection on the port, if I close the HTTP connection, will that close the WebSocket connection as well? Should that be something that the handler care about?