# new sock()
Access object to the websocket logic
Members
# (static) close :callable
to execute when the sockets is disconnected
Type:
- callable
# (static) connect :callable
function to connect to the websocket server
Type:
- callable
# (static) connectionErrors :number
the number of occured connection errors (to only try a few times and then stop)
Type:
- number
# (static) error :callable
to execute when the sockets loses connection or fails to connect
Type:
- callable
# (static) message :callable
to execute when the sockets receives something from the server
Type:
- callable
# (static) open :callable
to execute when the sockets is connected
Type:
- callable
Methods
# (static) connectIfNotConnected() → {boolean}
Function to make sure that a connection is established
Returns:
true on success
- Type
- boolean
# (static) event(eventname, callback)
function to override the socket callbacks
Parameters:
Name | Type | Description |
---|---|---|
eventname |
string | the name of the event |
callback |
Callable | a callback to exeute when the event occurs |
# (static) send(message)
function to send data to the websocket
Parameters:
Name | Type | Description |
---|---|---|
message |
string | a message to send to the websocket server |