It is a basic implementation of WebSocket protocol .
( url: string [, timeout: duration] ) : WebSocket
Static constructor of the WebSocket. Accepts websocket schema URL: "ws://domain/path". Returns new socket in INITIAL state. The timeout is a connection timeout. If timeout is exceeded while connecting error event will be generated.
( event: string, callback: function) : this
Subscribe callback on one of socket events:
The event name may contain ".namespace" part that can be used in .off() call.
( event: string, callback: function ) : this
Same as on() but subscribes the callback for once execution ( record is auto removed after first callback )
( event: string | callback: function ) : this
Unsubscribe callback either by its name or by its function reference.
Event name may contain only namespace part, so this: socket.off(".namespace")
will unsubscribe all handlers that were set with that namespace.
( data: string | Bytes )
The method sends message as a text or binary frame (message) to the WebSocket server.
( )
Sends disconnect request to the server and closes the socket.