-
Notifications
You must be signed in to change notification settings - Fork 1
Context
a context object that is given through callbacks during the 'request'
and 'message'
events.
{
message : [Object],
type : String,
connection : [Object:Connection]
}
'request'
context
{
message : [Object],
type : String,
connection : [Object:Connection],
reply : [Function],
error : [Function],
partial : [Function],
}
A javascript object representing the message/request recieved.
A String representing the type of message/request recieved.
A Connection Object representing the client/server connection that sent the message.
The function used to reply to a request that has been recieved. This will set the key
to whatever the request's key is and direction
to 'REPLY'
for you if you do not do it manually (see Use). This will resolve
the promise or be sent in as reply
in the callback on the other side (see Callbacks and Promises). This method can only be called once.
message
: A javascrtipt object representing the reply response you wish to send to whomever sent the request.
options
(optional) : three boolean flags mask
, binary
and compress
can be set (this follows the behavior of ws)
callback
: either a callback or defered object. The callback is called once the message has been recieved on the other end. It will call back with either an error or nothing.
This is the same as reply except it sets the direction to 'ERROR'
. This will fail
the promise or be sent in as err
in the callback on the other side (see Callbacks and Promises). This method can only be called once.
This is the same as reply except it sets the direction to 'PARTIAL'
. This will notify
the promise or be sent in as partial
in the callback on the other side (see Callbacks and Promises). This method can be called as many times as you want.