To use sockets, consider the WebSocket interface in JavaScript. This interface enables web applications to maintain bidirectional communications with server-side processes.
To enable Web applications to maintain bidirectional communications with server-side processes, this specification introduces the WebSocket interface.
Here are some of the methods to workaround with Web Sockets −
socket = new WebSocket(url [, protocols ] )
Create a new socket using this, wherein parameters URL is a string for the connection and protocols is a string or array of string.
socket . send( data )
The above is used to send data.
Used to close the socket connection.
socket . close( [ code ] [, reason ] )
The following returns the URL used to establish the connection.
socket . url