new SocketIOWrapper()
Socket io client wrapper https://www.npmjs.com/package/socket.io-client, used to manage a websocket communication
- Source
Classes
Methods
connectToServer()
Start websocket communication with window.location.host
- Source
emit(event, data)
Emit an event to the server with attach data
Parameters:
Name | Type | Description |
---|---|---|
event | string | event id |
data | object | attached data (all serializable data are supported) |
- Source
on(event, callback)
Register a callback on an event
Parameters:
Name | Type | Description |
---|---|---|
event | string | event id |
callback | cbSocketIO | callback called when the event is received |
- Source
reset(events)
Reset all events listened or only the ones listed in events parameter
Parameters:
Name | Type | Description |
---|---|---|
events | Array.<string> | list of events to reset |
- Source