Saturday, August 29, 2020

WebSockets



WebSockets is a protocol introduced at session layer in OSI (Open Systems Interconnection) model and rely on TCP (Transmission Control Protocol) to connect and send data. It provides full-duplex communication, i.e. enable bi-directional network data transfer at the same time.

It is often compared to HTTP/2.0 (Hypertext Transfer Protocol v2), however it is not meant to replace HTTP protocol. HTTP and WebSockets have their own pros and cons, developer should choose carefully which protocol to be used for optimal performance of the system.

Anyway, to start the connection for WebSockets, the client will always ask the server if the server supports WebSockets. This request is sent as HTTP-request. Once the server confirm by sending HTTP-response, then the client-server will start to communicate using WebSockets.

Further reads:


No comments:

Post a Comment