Class: Client

Client

Represents a client connected to a Coraline instance, it does have options for managing queries and messages It must not be confused with CoralineClient, this class does not act as client, is only a wrapper for sending and receiving info from connected clients

new Client (sock, id)

Name Type Description
sock Socket Socket of the parent coraline's master
id number Client ID

Extends

Members

id number

Client ID

iid number

ID Counter for queries

qmanager EventEmitter

Query EventEmitter

queries Object

Query manager object

sock Socket

SocketIO master connection

Methods

addQuery (fn)

Adds a query to the query pool
Name Type Description
fn function Query callback

message (signal)

Emits a message to the remote client
Name Type Description
signal String Signal to emit
...args Any repeatable Data to send

onquery (signal, cb)

Adds a listener to a query event
Name Type Description
signal String Event name to listen
cb function Callback fired each time a query with the specified signal is received

query (signal)

Emits a query to the remote client
Name Type Description
signal String Signal to emit
...args Any repeatable Data to send

resolve (iid)

Emits a resolve signal to the client
Name Type Description
iid number Query ID
...args Any repeatable Arguments to emit

resolveQuery (iid)

Runs a query and deletes it from the query pool
Name Type Description
iid number Query ID
...args Any repeatable Arguments to pass to the function