socket
Constants
EVENT_CONNECT : string = connect
EVENT_CONNECTING : string = connecting
EVENT_CONNECT_ERROR : string = connect_error
EVENT_CONNECT_TIMEOUT : string = connect_timeout
EVENT_DISCONNECT : string = disconnect
EVENT_ERROR : string = error
EVENT_MESSAGE : string = message
EVENT_PING : string = ping
EVENT_PONG : string = pong
EVENT_RECONNECT : string = reconnect
EVENT_RECONNECTING : string = reconnecting
EVENT_RECONNECT_ATTEMPT : string = reconnect_attempt
EVENT_RECONNECT_ERROR : string = reconnect_error
EVENT_RECONNECT_FAILED : string = reconnect_failed
Functions
newSocket(url, options = {}) — creates new SocketValue
options (map with keys):
- forceNew (boolean)
- multiplex (boolean)
- reconnection (boolean)
- rememberUpgrade (boolean)
- secure (boolean)
- timestampRequests (boolean)
- upgrade (boolean)
- policyPort (integer)
- port (integer)
- reconnectionAttempts (integer)
- reconnectionDelay (timestamp - long)
- reconnectionDelayMax (timestamp - long)
- timeout (timestamp - long) - set -1 to disable
- randomizationFactor (double)
- host (string)
- hostname (string)
- path (string)
- query (string)
- timestampParam (string)
- transports (array of strings)
Types
SocketValue
Functions
close() — disconnects the socket
connect() — connects the socket
connected() — returns connected status (1 - connected, 0 - no)
disconnect() — disconnects the socket
emit(event, data) — emits an event
hasListeners(event) — returns true if there is listeners for specified event
id() — returns socket id
off(event = ..) — removes specified event handler, or removes all if no arguments were passed
on(event, listener) — adds event listener
once(event, listener) — adds one time event listener
open() — connects the socket
send(data) — send messages