Class: SocketCommunicator

SocketCommunicator

new SocketCommunicator()

Default Constructor that initializes the Communicator
Source:

Extends

  • EventEmitter

Methods

(static) getSocketCommunicator()

Static Function to get the singleton SocketCommunicator
Source:

connectTo(hostArray, finalCallback)

Function that connects to the remote servers found on the local area network
Parameters:
Name Type Description
hostArray Array Clients to connect to.
finalCallback function Function to be called after all connections are done.
Source:

emitEvent(event, data, sockets, callback)

Function that emits the specified event and data to all sockets. If an array of sockets are given, then the event is emitted to only those clients
Parameters:
Name Type Description
event String The name of the event
data JSON Data to be send
sockets Array Clients to emit event to (if applicable)
callback function Called after all events are emitted
Source:

initalizeServer()

Function that initializes the server to listen for connection on the specified port and starts listening for connections
Source: