Web PubSub

Azure Web PubSub emulation: a REST management surface plus WebSocket client connections using the json.webpubsub.azure.v1 subprotocol. Compatible with the azwebpubsub SDK.

Endpoint

URLhttp://127.0.0.1:10004
ProtocolHTTP + WebSocket
PersistedNo โ€” hub state is in-memory

Configuration

FlagEnvironment variableDefault
-webpubsub-addrLOCALAZ_WEBPUBSUB_ADDR:10004

Supported operations

OperationSurface
Client connectGET /client/hubs/{hub} (WebSocket upgrade)
Send to allPOST /api/hubs/{hub}/:send
Send to groupPOST /api/hubs/{hub}/groups/{group}/:send
Send to userPOST /api/hubs/{hub}/users/{user}/:send
Send to connectionPOST /api/hubs/{hub}/connections/{conn}/:send
Add / remove from groupPUT / DELETE /api/hubs/{hub}/groups/{group}/connections/{conn}
Close connectionDELETE /api/hubs/{hub}/connections/{conn}

Client access URLs are signed locally; group join/leave and acks over the WebSocket are supported.

Web PubSub is SDK-only for the CLI: az webpubsub service resolves its endpoint from ARM via -n/-g, with no --endpoint/--connection-string override to redirect it to 127.0.0.1.

Example: Go SDK

const endpoint = "http://127.0.0.1:10004"
client, _ := azwebpubsub.NewClientFromConnectionString(
    "Endpoint=http://127.0.0.1:10004;AccessKey=test;", "hub1", nil)

// Broadcast to every client connected to the hub.
client.SendToAll(ctx, azwebpubsub.ContentTypeTextPlain,
    streaming.NopCloser(strings.NewReader("hello everyone")), nil)

Example: Azure CLI

Not applicable โ€” the az webpubsub data-plane commands cannot be redirected to a local endpoint. Use the Go SDK example above.