146
E. Fraccaroli and D. Quaglia
network boundaries can facilitate communication for clients without a globally
routable address, by relaying messages with external servers.
3.4.2 WebSocket
WebSocket is an Application Layer protocol, providing a full-duplex communication channel over a TCP connection originally created for an HTTP connection. The
IETF standardized the WebSocket protocol as RFC 6455 in 2011 [74], and the World
Wide Web Consortium (W3C) is standardizing the WebSocket API in Web Interface
Definition Language [75]. WebSocket and HTTP are located at the Application
Layer in the ISO/OSI model and, as such, depend on TCP at Transport Layer. A
WebSocket connection originates from an HTTP connection by using the HTTP
Upgrade header as shown in the message sequence chart depicted in Fig. 3.27. The
WebSocket protocol enables a peer-to-peer interaction between the agent previously
acting as HTTP client (e.g., a web browser or other client application) and the
one previously acting as HTTP server so that the latter can send content to the
former without being first requested by it as in HTTP. WebSocket protocol also
allows to keep the connection open and support TLS-based security. Since the
WebSocket connection uses the previously created HTTP connection, it is compliant
with NAT-based and firewall-protected networks. In summary, WebSocket protocol
allows two-way conversation without recurring to complex workarounds and thus
facilitating real-time data transfer.
Fig. 3.27 Example of
WebSocket life cycle
Client
Server
HTTP Upgrade
WS Request
WS Response
TCP
HTTP
Web
Socket
Précédent

- 154/647

Suivant