Azure Web PubSub Real-Time Messaging
Build TypeScript WebSocket messaging, group communication, and live notification features with Azure Web PubSub.
The skill shows Microsoft Entra, managed identity, and connection-string authentication, plus permission configuration and connection management. However, it does not specify least privilege, sensitive-data handling, or confirmation requirements, and it directly logs token.url containing an access token, creating a possible credential-exposure risk; points are deducted.
The installation, server, client, and Express paths are clearly organized, with brief lifecycle and reconnection handling. However, the Express example references undefined serviceClient and req.user, and lacks input validation, failure handling, compatibility guidance, and reproducible tests; static evidence is insufficient, so the score remains conservative.
The name, description, and trigger scenarios are clear, covering WebSocket features, pub/sub, chat, and live notifications. Non-fit boundaries, precise input/output expectations, browser versus Node.js constraints, Chinese-language support, and mainland-China network reachability are not documented, so points are deducted.
Documentation is layered across installation, authentication, server, client, event handling, types, and best practices, with MIT, author, and version metadata. It lacks a changelog, explicit maintenance owner and update path, troubleshooting, known limitations, and a complete end-to-end example, preventing a full score.
Examples cover token generation, broadcast, user and connection sends, groups, connection management, client events, and Express handlers, providing useful core-task guidance. However, key examples are incomplete and contain undefined references, requiring substantial manual validation and integration; static review cannot establish directly runnable output.
The material is tied to a fixed repository revision, and the repository includes general CI, Vally workflow, and harness tests. The supplied files do not include skill-specific acceptance criteria, skill-specific test results, or third-party execution evidence, so key paths cannot be independently reproduced and only limited credit is justified.
- Do not log token.url or any complete URL containing access_token; prevent token logging and use secure secret management.
- serviceClient and req.user are undefined in the Express negotiation example; add authentication middleware, client initialization, input validation, and error responses before deployment.
- Closing groups, disconnecting users, and changing permissions have external effects; define authorization boundaries, auditing, and recovery procedures for production.
- Verify API signatures, event types, and package compatibility against the actual SDK versions, and add runnable tests.
What it does & when to use it
This skill supports developers using the Azure Web PubSub TypeScript SDKs for server management, client connections, and Express event handling. It covers authentication, client access tokens, broadcasts, user- and connection-targeted messages, groups, permissions, and connection lifecycle events. It also documents Microsoft Entra credentials, reconnection handling, handler registration, and connection validation. It fits teams adding chat, channel-based communication, or live notifications to JavaScript or TypeScript applications.
It guides developers through installing @azure/web-pubsub, @azure/web-pubsub-client, @azure/identity, and @azure/web-pubsub-express; configuring connection strings, endpoints, and credential environment variables; creating WebPubSubServiceClient and WebPubSubClient instances; generating client access tokens; sending messages to all connections, users, connections, or groups; managing groups, connections, and permissions; registering connected, disconnected, group-message, and server-message handlers; and using Express middleware for connection handling, user events, and negotiation endpoints.
- A TypeScript backend developer needs to issue Web PubSub client access URLs and send chat messages to users or groups.
- A frontend developer needs a browser client that connects to Azure Web PubSub, joins groups, and receives real-time group messages.
- A product team needs channel-based group chat, topic communication, or real-time collaboration features.
- An application team needs live notifications targeted to online clients by user, connection, or OData filter.
- An Express application needs authorization and business handling for connection requests and custom user events.
Pros & cons
- Covers the three main integration surfaces: server SDK, client SDK, and Express event handling.
- Includes concrete examples for broadcasts, user messages, connection messages, groups, permissions, and connection closure.
- Shows connection string, Microsoft Entra Token Credential, and AzureKeyCredential authentication patterns.
- Provides directly usable TypeScript patterns for chat, group messaging, live notifications, and custom events.
- Focuses on SDK integration and does not provide Azure Web PubSub resource provisioning or infrastructure deployment steps.
- The source does not provide skill-specific test coverage results, retry strategies, or performance benchmarks.
- It does not specify SDK or Node.js versions, so compatibility should be checked against the target project.
- Examples require an Azure Web PubSub resource, endpoint or connection string, and suitable credentials.
How to install
Install the collection with npx skills add microsoft/skills, then select azure-web-pubsub-ts in the wizard. The skill is installed in the selected agent directory, such as .github/skills/ for GitHub Copilot. Install runtime packages with npm install @azure/web-pubsub @azure/identity; add npm install @azure/web-pubsub-client for client messaging and npm install @azure/web-pubsub-express for Express event handling. The source does not provide a standalone installation command or package versions for this skill.
How to use
After loading the skill in an Agent Skills-compatible coding agent, use a prompt such as “Implement Azure Web PubSub group chat in my TypeScript app, including server-side token negotiation, client reconnection, group messaging, and Express connection authorization.” Follow the examples to create server and client SDK instances, set WEBPUBSUB_CONNECTION_STRING or WEBPUBSUB_ENDPOINT, and register client handlers before calling start(). For production, use ManagedIdentityCredential or another explicit credential as appropriate.