Join 36000+ teachers and students using TTIO.
WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. The WebSocket protocol was standardized by the IETF as RFC 6455 in 2011, and the WebSocket API in Web IDL is being standardized by the W3C.
WebSocket is distinct from HTTP. Both protocols are located at layer 7 in the OSI model and depend on TCP at layer 4.
A socket is one endpoint of a two-way communication link between two programs running on the network. A socket is bound to a port number so that the TCP layer can identify the application that data is destined to be sent to. An endpoint is a combination of an IP address and a port number
A connection between two computers uses a socket.
A socket is the combination of IP address plus port
Imagine sitting on your PC at home, and you have two browser windows open. One looking at the Google website, and the other at the Yahoo website. The connection to Google would be:
Your PC – IP1+port 60200 ——– Google IP2 +port 80 (standard port) The combination IP1+60200 = the socket on the client computer and IP2 + port 80 = destination socket on the Google server.
The connection to Yahoo would be:
your PC – IP1+port 60401 ——–Yahoo IP3 +port 80 (standard port) The combination IP1+60401 = the socket on the client computer and IP3 + port 80 = destination socket on the Yahoo server.