There are several key characteristics of Web socket:
- Bi-directional: HTTP is a uni-directional protocol where a request is always initiated by client, server processes and returns a response, and then the client consumes it. WebSocket is a bi-directional protocol where there are no pre-defined message patterns such as request/response. Either client or server can send a message to the other party.
- Full-duplex: HTTP allows the request message to go from client to server and then server sends a response message to the client. At a given time, either client is talking to server or server is talking to client. WebSocket allows client and server to talk independent of each other.
- Single TCP Connection: Typically a new TCP connection is initiated for a HTTP request and terminated after the response is received. A new TCP connection need to be established for another HTTP request/response. For WebSocket, the HTTP connection is upgraded using standard HTTP Upgrade mechanism and client and server communicate over that same TCP connection for the lifecycle of WebSocket connection.
- Enables the server to push data to the connected clients.
- Avoid heavy traffic / loads of server requests.
- Enable messages to be delivered "instantly" (real-time).
- Reducing the heavy traffic / loads of server requests
For monitoring, we do have constant, client (agent) and sever communication. It's important to have efficient communication.
- Enabling server to client communication
For Cloud management tool, there are needs to push down actions and notify clients (agents) of server upgrade/patching. Using the Web socket avoids the checking request from the client (agent) to the server required by the HTTP protocol.
- Enabling real-time monitoring
Web socket allows real-time message delivery which makes the real-time monitoring possible.