explain websockets code example

Example: what are websockets

persistent bi-directional communication channel between 
a client (e.g. a browser) and a backend service. 
In contrast with HTTP request/response connections, websockets 
can transport any number of protocols
provide  message delivery without polling
without racy, high-latency, and bandwidth-intensive implementations
establish TCP-style connections in a browser-compatible 
fashion using HTTP during initial setup.
Messages over websockets can be provided in any protocol, 
remove unnecessary overhead of HTTP requests and responses 
(including headers, cookies, and other artifacts).

Tags:

Misc Example