subscribe websocket on backend
This block is part of the websocket group and was last modified in core v13.0.5.
subscribe websocket on backend v13.0.5 Subscribes the websocket to a specific channel. All broadcasts will be handled in the backend.
- flow
- channels
arrayrequiredMultiple channels you would like the server to subscribe / listen on • Hidden when other fields are filled
- channel
valuerequiredA channel you would like the server to subscribe / listen on • Hidden when other fields are filled
- events
arrayListen on the provided events. If you would like to listen on all events within this channel, leave this array empty or provide
*as one of the values. - skip jwt
conditionrequiredSkips the broadcast of subscriptions to the frontend. If set to true, the frontend will not be able to resubscribe on the channels where the broadcast was skipped.
- flow
- on broadcast
execute_functionThe callback function requested whenever we received any event on any of the given channels
- success
conditionIndicates if we could start subscribing at all,
truecould indicate we subscribed to one of the many given channels. - error
value - channels
arrayChannels we succesfully subcribed to
Subscribes the current websocket connection to the given channels (the channels array, or the single channel value) and runs the function wired to on_broadcast for each incoming broadcast, passing its event and message. success=true only means the block ran with a callback and a websocket : it stays true even when ZERO channel subscriptions succeeded, so check the channels output for what actually subscribed. An empty channel list fails with MISSING_CHANNELS, no wired callback with MISSING_CALLBACK, no active websocket with MISSING_WEBSOCKET; in simulation it does nothing and errors PRODUCTION_RUN_ONLY. An empty events array listens to all events on the channel; skipjwt=true hides the subscription from the frontend.
A typical wiring for subscribe websocket on backend: a function trigger starts the flow; the function out pin wires to an execute block.
Version history
Introduced in v13.0.5.
Back to
websocket Return to the main group to view all sub-groups Back to websocket Return to the group to view all blocks within this group 