Back to Skills

websocket

verified

Production-grade WebSocket patterns for Python (FastAPI/Starlette) with connection management, rooms, and message protocols

View on GitHub

Marketplace

fullstack-agents

adelabdelgawad/fullstack-agents

Plugin

fullstack-agents

Repository

adelabdelgawad/fullstack-agents

plugins/fullstack-agents/skills/websocket/SKILL.md

Last Verified

January 25, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/adelabdelgawad/fullstack-agents/blob/main/plugins/fullstack-agents/skills/websocket/SKILL.md -a claude-code --skill websocket

Installation paths:

Claude
.claude/skills/websocket/
Powered by add-skill CLI

Instructions

# WebSocket Skill

Production-grade WebSocket patterns for real-time communication in Python applications.

## When to Use This Skill

Use this skill when:
- Building real-time features (chat, notifications, live updates)
- Implementing bidirectional client-server communication
- Creating collaborative features (multi-user editing, presence)
- Building dashboards with live data feeds
- Implementing game servers or real-time applications

## Core Mental Model

A WebSocket connection is fundamentally different from HTTP:

```
HTTP:     Request → Response → Done
WebSocket: Connect → Accept → [Receive Loop] → Disconnect → Cleanup
```

The **receive loop** is unavoidable because:
1. The connection is long-lived - something must continuously listen
2. Messages arrive asynchronously from the client
3. The loop defines the connection's lifetime boundary
4. Even when frameworks abstract it, a loop exists underneath

## Architecture Overview

```
┌─────────────────────────────────────────────────────────────┐
│                     WebSocket System                         │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌──────────────┐    ┌──────────────────────────────────┐  │
│  │   Client 1   │───▶│                                  │  │
│  └──────────────┘    │                                  │  │
│                      │     Connection Manager           │  │
│  ┌──────────────┐    │  ┌─────────────────────────────┐ │  │
│  │   Client 2   │───▶│  │ connections: Set[WebSocket] │ │  │
│  └──────────────┘    │  │ rooms: Dict[str, Set[WS]]   │ │  │
│                      │  └─────────────────────────────┘ │  │
│  ┌──────────────┐    │                                  │  │
│  │   Client N   │───▶│  connect() → track              │  │
│  └──────────────┘    │  disconnect() → remove          │  │
│                      │  broadcast() → fan-out          │  │
│                      │  send_to_room(

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
6752 chars