capabilities.work

Generate Token then Broadcast

A 2-step recipe with Azure Web PubSub. We can help you get access.

Recipe · 2 steps

Generate Token then Broadcast

Generate a client access token for a hub, then broadcast a message to all connections.

  1. Mint a client access token for the hub that browser clients use to connect to the Web PubSub service.
  2. Broadcast the supplied plain-text message to every connection in the hub.
What you'll need to have ready
  • accessToken: JWT bearer token signed with the service AccessKey (HS256) or an Entra ID token.
  • apiVersion: Data plane REST API version.
  • hub: Target hub name.
  • userId: Optional user id to embed in the generated client token.
  • minutesToExpire: Token lifetime in minutes.
  • message: The plain-text message to broadcast to all connections.
For your developer

Arazzo workflow microsoft-azure-web-pubsub:generate-token-then-broadcast, 2 operations: webPubSub_generateClientToken → webPubSub_sendToAll. Specs on APIs.io.