---
title: Webrockets 🚀
description: High-performance WebSocket server for Python with first-class Django support.
template: splash
hero:
  tagline: A Rust-powered WebSocket server for Python
  actions:
    - text: Get Started
      link: /guides/introduction/
      icon: right-arrow
    - text: View on GitHub
      link: https://github.com/ploMP4/webrockets
      icon: external
      variant: minimal
---

import { Card, CardGrid } from '@astrojs/starlight/components';

<CardGrid stagger>
  <Card title="High-performance" icon="rocket">
    Core server written in Rust using axum and fastwebsockets for maximum performance.
  </Card>
  <Card title="Django Integration" icon="puzzle">
    Built-in authentication classes and management commands for seamless Django integration.
  </Card>
  <Card title="Pattern Matching" icon="seti:json">
    Route messages based on JSON fields with optional Pydantic validation.
  </Card>
  <Card title="Broadcasting" icon="approve-check-circle">
    Built-in support for Redis and RabbitMQ message brokers for multi-server deployments.
  </Card>
</CardGrid>

## Performance

webrockets significantly outperforms other Python WebSocket implementations thanks to its Rust-powered core.

![Benchmark: 100 connections, 20 byte messages](/benchmarks/100-20-chart.svg)

In a simple echo benchmark with 100 concurrent connections, webrockets achieves up to **10x higher throughput** compared to Django Channels with Daphne. See the [full benchmark results](/benchmarks/) for detailed comparisons.

## 🛠️ Quick Example

```python
from webrockets import WebsocketServer, Connection

server = WebsocketServer(host="0.0.0.0", port=8080)
chat = server.create_route("ws/chat/", "chat")

@chat.receive
def on_message(conn: Connection, data: str | bytes):
    conn.send(f"You said: {data}")
    conn.broadcast(["chat"], data)

if __name__ == "__main__":
	server.start()
```

## 📦 Installation

```bash
# Basic installation
pip install webrockets

# With Django integration
pip install webrockets[django]

# With Pydantic schema validation
pip install webrockets[schema]

# All extras
pip install webrockets[schema,django]
```
