Tags
Tags allow for multicasting of messages to multiple sockets using a single command. Sockets can be tagged or untagged using commands, Pipeline commands, or the messaging API. Once a socket is associated with a tag, any data sent to that tag will go to that socket (as well as any others associated with the same tag).
Tags are strings, and a record of each tag associated with a socket is in the metadata sent to Functions and available to Pipelines.
Examples
Broadcast to every socket
Hooks:
hooks:
CONNECT:
- name: OnConnection
commands:
- command: tag
params:
tagsToAdd:
- all
MESSAGE:
- name: OnMessage
commands:
- command: message
params:
message: ${DATA}
tags:
- all
These two hooks will a) tag every socket with all
when they connect b) anytime a socket sends data, send it to every socket (by sending it to the all
tag).