@node-red/runtime.comms

This is the comms subsystem of the runtime.

addConnection(opts) → {Promise.<Object>}

Registers a new comms connection

Parameters:
Name Type Description
opts Object
Name Type Description
user User

the user calling the api

client CommsConnection

the client connection

Returns:
Type:
Promise.<Object>
  • resolves when complete

removeConnection(opts) → {Promise.<Object>}

Unregisters a comms connection

Parameters:
Name Type Description
opts Object
Name Type Description
user User

the user calling the api

client CommsConnection

the client connection

Returns:
Type:
Promise.<Object>
  • resolves when complete

subscribe(opts) → {Promise.<Object>}

Subscribes a comms connection to a given topic. Currently, all clients get automatically subscribed to everything and cannot unsubscribe. Sending a subscribe request will trigger retained messages to be sent.

Parameters:
Name Type Description
opts Object
Name Type Description
user User

the user calling the api

client CommsConnection

the client connection

topic String

the topic to subscribe to

Returns:
Type:
Promise.<Object>
  • resolves when complete

unsubscribe(opts) → {Promise.<Object>}

TODO: Unsubscribes a comms connection from a given topic

Parameters:
Name Type Description
opts Object
Name Type Description
user User

the user calling the api

client CommsConnection

the client connection

topic String

the topic to unsubscribe from

Returns:
Type:
Promise.<Object>
  • resolves when complete