subscribe([options]) |
Activate this channel so that it will receive all data published to it from the backend. You can provide an optional options object in the
form {waitForAuth: true, data: someCustomData} (all properties are optional) - If waitForAuth is true, the channel
will wait for the underlying socket to become authenticated before trying to subscribe to the server - This channel will then
behave as a "private channel" - Note that in this case, "authenticated" means that the client socket has received a valid JWT authToken - Read about the server-side socket.setAuthToken(tokenData) function here for more details.
The data property of the options object can be used to pass data along with the subscription.
|
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 is in a pending state |
transmitPublish(data)
|
Publish data to this channel. Do not expect a response from the server.
The data argument can be any JSON-compatible object/array or primitive.
|
invokePublish(data)
|
Publish data to this channel. Expect a response from the server.
The data argument can be any JSON-compatible object/array or primitive.
This method returns a Promise which will be rejected if the operation fails.
For example, it can be rejected if the MIDDLEWARE_INBOUND middleware blocks the action on the server side.
The promise will resolve once the server has processed the publish action.
|
listener(eventName)
|
This method returns an event listener stream for the specified eventName . This object is an asyncIterable which can be consumed with a for-await-of loop.
|
closeListener(eventName)
|
This method will signal to all consuming for-await-of loops (for the eventName listener) to break after they have finished iterating over their current backlogs of events.
|
closeAllListeners()
|
This method will signal to all consuming for-await-of loops for all listeners to break after they have finished consuming their respective backlogs of events.
|
killListener(eventName)
|
This method will signal to all consuming for-await-of loops for the eventName listener to break immediately and will reset the backpressure for that listener to 0.
|
killAllListeners()
|
This method will signal to all consuming for-await-of loops for all listeners to break immediately and will reset the aggregate backpressure for all listeners to 0.
|
closeOutput()
|
This method will signal to all consuming for-await-of loops for the channel's output stream to break after they have finished consuming their backlogs of data.
|
killOutput()
|
This method will signal to all consuming for-await-of loops for the channel's output stream to break immediately and will reset the aggregate backpressure for the channel's output stream to 0.
|
close()
|
This method will signal to all consuming for-await-of loops for all of the channel's streams (including all listener streams) to break after they have finished consuming their backlogs of data.
|
kill()
|
This method will signal to all consuming for-await-of loops for all of the channel's streams (including all listener streams) to break immediately and will reset the aggregate backpressure for the channel to 0.
|
getBackpressure()
|
Get the aggregate backpressure for all streams on the current channel. The aggregate backpressure represents the highest backpressure of all consumers.
|
getOutputBackpressure()
|
Get the aggregate backpressure for the main output stream of the current channel. The aggregate backpressure represents the highest backpressure of all consumers.
|
getAllListenersBackpressure()
|
Get the aggregate backpressure for all listener streams on the current channel. The aggregate backpressure represents the highest backpressure of all consumers.
|
getListenerBackpressure(eventName)
|
Get the aggregate backpressure for the eventName listener stream on the current channel. The aggregate backpressure represents the highest backpressure of all consumers for that listener.
|