SocketIOWrapper

new SocketIOWrapper()

Socket io client wrapper https://www.npmjs.com/package/socket.io-client, used to manage a websocket communication

Classes

SocketIOWrapper

Methods

connectToServer()

Start websocket communication with window.location.host

emit(event, data)

Emit an event to the server with attach data

Parameters:
NameTypeDescription
eventstring

event id

dataobject

attached data (all serializable data are supported)

on(event, callback)

Register a callback on an event

Parameters:
NameTypeDescription
eventstring

event id

callbackcbSocketIO

callback called when the event is received

reset(events)

Reset all events listened or only the ones listed in events parameter

Parameters:
NameTypeDescription
eventsArray.<string>

list of events to reset