CLICommands

pubsub

snug pubsub <COMMAND>

Pub/Sub operations.

Subcommands

CommandWhat it does
publishPublish a message to a channel
publish-batchPublish one message to many channels in a single call
channelsList channels that currently have active subscribers
infoShow subscriber count for a channel (Redis PUBSUB NUMSUB total)
statsShow the Redis vs WebSocket subscriber breakdown for a channel
debugShow a pub/sub system-state snapshot (Redis + WebSocket connections)
listenListen to messages on a channel until interrupted
tokenMint a short-lived pub/sub capability token for the current principal
grantGrant a capability on a resource to another principal
grantsList capability grants you have issued or received
revokeRevoke a single grant by id
revoke-allRevoke every grant you have made to a grantee
claim-roomClaim a shared room (room.{name}) first-come for the current principal

Run snug pubsub <command> --help for that command's own options. The global options apply everywhere.

Examples

snug pubsub publish -c alerts.system -p '{"severity":"warning","msg":"High CPU"}'
snug pubsub publish -c alerts.system -p '{"msg":"hi"}' -t trace-12345
snug pubsub publish-batch -c alerts.system -c audit.log -p '{"event":"deploy"}'
snug pubsub channels
snug pubsub info alerts.system
snug pubsub stats alerts.system
snug pubsub debug
snug pubsub listen --channel alerts.system
snug pubsub listen --channel alerts.system --raw | jq .payload
snug pubsub token
snug pubsub claim-room lobby
snug pubsub grant -r room.lobby -g bob -o subscribe -o publish
snug pubsub grants --direction received
snug pubsub revoke <grant_id>
snug pubsub revoke-all --grantee bob

Next

On this page