HOWS DOS YOUS MAKES A WEBSOCKETS SERVER code example

Example 1: js connect to websocket

var exampleSocket = new WebSocket("wss://www.example.com/socketserver", "protocolOne");

Example 2: 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).