# Build Real-Time Apps with Azure Web PubSub

Real-time Python messaging requires careful token, group, connection, and permission handling. This skill provides focused Azure Web PubSub SDK patterns for common service and client workflows.

## Install

```bash
npx skillstore add sickn33/azure-messaging-webpubsubservice-py
```

## Metadata

- Status: approved
- Slug: sickn33-azure-messaging-webpubsubservice-py
- Skillstore revision: r2
- Version status: missing
- Tree hash: b1c7e45ed88f59d885845194c97c0bda6d8aeaacc683f9ca24497d1551b8765c
- Author: sickn33
- GitHub username: sickn33
- License: MIT
- Repository: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/azure-messaging-webpubsubservice-py
- Ref: f9e2c34b4f19c7f3e6b0a1e93227b5f77cc12526
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands, network, env\_access
- Quality score: 69
- Public page: https://skillstore.pages.dev/skills/sickn33-azure-messaging-webpubsubservice-py
- Manifest: https://skillstore.pages.dev/api/skills/sickn33-azure-messaging-webpubsubservice-py/manifest

## Capabilities

- Configure service clients with an Azure connection string or DefaultAzureCredential.
- Generate client access tokens with user identities, roles, and initial groups.
- Send text or structured messages to all clients, users, groups, or connections.
- Manage group membership, connection state, disconnections, and client permissions.
- Create Python client event handlers for connection, server-message, and group-message events.
- Use the asynchronous service client and close Azure credentials and clients correctly.

## Use Cases

- Add Application Notifications: Create server-side Python flows that broadcast updates or target specific users and connections.
- Build Group Messaging: Implement group membership and targeted messages for rooms, teams, or collaborative sessions.
- Review Access Controls: Compare token roles and connection permissions before integrating Web PubSub into an Azure architecture.

## Prompt Templates

### Create a Service Client

```
Show how to initialize an Azure Web PubSub service client in Python using DefaultAzureCredential for endpoint [endpoint] and hub [hub].
```

### Send Targeted Messages

```
Design Python examples that send [message] to all clients, user [user_id], group [group], and connection [connection_id]. Explain content types.
```

### Manage Groups and Permissions

```
Create a secure workflow for adding user [user_id] to group [group], granting [permission], checking access, revoking access, and removing membership.
```

### Design an Async Messaging Service

```
Design an asynchronous Python Web PubSub service for [application]. Include credential lifecycle, token handling, group delivery, failure handling, cleanup, and testing considerations.
```

## Limitations

- Provides documentation patterns, not an executable deployment or complete application.
- Requires an existing Azure Web PubSub resource, valid credentials, and installed Azure SDK packages.
- Does not cover production retry policies, monitoring, scaling, or complete reconnection logic.
- Uses placeholder endpoints, hub names, user IDs, groups, and connection IDs that require validation.

## Best Practices

- Prefer DefaultAzureCredential and managed identities when the deployment environment supports them.
- Grant only required client roles and issue short-lived access tokens.
- Close asynchronous clients and credentials, and validate reconnection behavior under failure.

## Anti Patterns

- Do not print, persist, or expose generated client access URLs.
- Do not grant broad send or group permissions when a narrower role is sufficient.
- Do not use placeholder identifiers or endpoints without environment-specific validation.

## Security Audit

- Audited at: 2026-07-23T20:51:58.807\+00:00
- Summary: All 38 static findings are false positives caused by Markdown fences, inline method names, placeholder Azure endpoints, and a standard environment-variable credential lookup. The examples contain no executable backtick expressions, suspicious destinations, or environment-variable exfiltration. One separate medium-risk issue remains because the token-generation example prints a client access URL that can expose its bearer credential.

## Stats

- Views: 90
- Downloads: 9
- Favorites: 0
- Popularity score: 0
