Instances of the SCChannel object let you subscribe to and watch for incoming data which is published on that channel by other clients or publishers.
This object is the server-side equivalent to the client-side SCChannel object.
getState() |
Returns the state of the channel as a string. Can be channel.SUBSCRIBED, channel.PENDING or channel.UNSUBSCRIBED. |
subscribe() |
Activate this channel so that it will receive all data published to it from the backend. |
unsubscribe() |
Deactivate this channel. |
isSubscribed([includePending]) |
Check whether or not this channel is active (subscribed to the backend). The includePending argument is optional, if true, the function will return true if the channel subscription is in a pending state. |
publish(data, [callback]) |
Publish data to this channel.
The optional callback is in the form callback(err).
|
watch(handler) |
Capture any data which is published to this channel. The handler is a function in the form handler(data). |
unwatch([handler]) |
Unbind the specified handler from this channel. If no handler is specified, it will unbind all handlers. |
watchers() |
Get a list of functions which are currently observing this channel. |
destroy() |
Destroy the current SCChannel object - This makes it unusable and it will allow it to be garbage collected. |