How do WebSockets work
To initiate a WebSocket session, the client must send an HTTP request with an
Upgrade: websocket header field. This informs the server that the peer client has asked the server to switch to the WebSocket protocol.
You may notice that the same happens in WildFly for Remote EJBs; the initial connection is made using an HTTP request, and is later switched to the remote protocol thanks to the
Upgrade mechanism. The standard
Upgrade header field can be used to handle any protocol, other than HTTP, which is accepted by both sides (the client and server). In WildFly, this allows you to reuse the HTTP port (
8080) for other protocols and therefore minimise the number of required ports that should be configured.
If the server ...