# crossbario/autobahn-python architecture

> Architecture diagram of the GitHub repository crossbario/autobahn-python, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/crossbario/autobahn-python
- Repository: https://github.com/crossbario/autobahn-python

## Overview

Autobahn|Python is a Python framework for WebSocket and WAMP clients and servers, with Twisted and asyncio integrations. An application creates a protocol or WAMP component; the runtime connects it to a peer, exchanges WebSocket messages, and, for WAMP, carries routed RPC and publish/subscribe traffic through a WAMP router. The graph also preserves authentication, serialization, compression, RawSocket, and FlatBuffers capabilities. The README establishes the main workflows; sampled source excerpts are limited, so uncertain internal dispatch links are omitted.

Main entry points: [`src/autobahn/websocket/protocol.py`](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/websocket/protocol.py) (WebSocket protocol), [`src/autobahn/wamp/protocol.py`](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/wamp/protocol.py) (WAMP protocol), [`src/autobahn/wamp/websocket.py`](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/wamp/websocket.py) (WAMP over WebSocket), [`src/autobahn/wamp/component.py`](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/wamp/component.py) (WAMP session)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime integrations"]
  node_asyncio["asyncio API<br/>[websocket.py]"]
  node_twisted["Twisted API<br/>[websocket.py]"]
  node_asyncio_component["asyncio components<br/>[component.py]"]
  node_twisted_component["Twisted components<br/>[component.py]"]
end

subgraph group_websocket["WebSocket"]
  node_ws_protocol["WebSocket protocol<br/>[protocol.py]"]
  node_ws_compression["Compression<br/>[compress.py]"]
  node_ws_validation["UTF-8 validation<br/>[utf8validator.py]"]
end

subgraph group_wamp["WAMP"]
  node_wamp_session["WAMP session<br/>[component.py]"]
  node_wamp_protocol["WAMP protocol<br/>[protocol.py]"]
  node_wamp_ws["WAMP over WebSocket<br/>[websocket.py]"]
  node_wamp_auth["WAMP authentication<br/>[auth.py]"]
  node_wamp_message["WAMP messages<br/>[message.py]"]
end

subgraph group_encoding["Serialization"]
  node_wamp_serializer["WAMP serializers<br/>[serializer.py]"]
  node_flatbuffers["FlatBuffers runtime<br/>[builder.py]"]
end

subgraph group_rawsocket["RawSocket"]
  node_raw_asyncio["asyncio RawSocket<br/>[rawsocket.py]"]
  node_raw_twisted["Twisted RawSocket<br/>[rawsocket.py]"]
  node_raw_core["RawSocket core<br/>[__init__.py]"]
end

node_application(("Application"))
node_peer(("WebSocket peer"))
node_router(("WAMP router"))

node_application -->|"uses"| node_asyncio
node_application -->|"uses"| node_twisted
node_asyncio -->|"runs protocol"| node_ws_protocol
node_twisted -->|"runs protocol"| node_ws_protocol
node_ws_protocol -->|"exchanges frames"| node_peer
node_ws_protocol -->|"compresses messages"| node_ws_compression
node_ws_protocol -->|"validates text"| node_ws_validation
node_application -->|"creates component"| node_asyncio_component
node_application -->|"creates component"| node_twisted_component
node_asyncio_component -->|"runs session"| node_wamp_session
node_twisted_component -->|"runs session"| node_wamp_session
node_wamp_session -->|"issues actions"| node_wamp_protocol
node_wamp_protocol -->|"authenticates"| node_wamp_auth
node_wamp_protocol -->|"handles messages"| node_wamp_message
node_wamp_protocol -->|"serializes messages"| node_wamp_serializer
node_wamp_protocol -->|"uses transport"| node_wamp_ws
node_wamp_ws -->|"carries WAMP"| node_ws_protocol
node_wamp_ws -->|"routes traffic"| node_router
node_wamp_serializer -.->|"uses encoding"| node_flatbuffers
node_application -->|"uses"| node_raw_asyncio
node_application -->|"uses"| node_raw_twisted
node_raw_asyncio -->|"uses"| node_raw_core
node_raw_twisted -->|"uses"| node_raw_core
node_raw_core -.->|"exchanges traffic"| node_router

click node_asyncio "https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/asyncio/websocket.py"
click node_twisted "https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/twisted/websocket.py"
click node_asyncio_component "https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/asyncio/component.py"
click node_twisted_component "https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/twisted/component.py"
click node_ws_protocol "https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/websocket/protocol.py"
click node_ws_compression "https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/websocket/compress.py"
click node_ws_validation "https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/websocket/utf8validator.py"
click node_wamp_session "https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/wamp/component.py"
click node_wamp_protocol "https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/wamp/protocol.py"
click node_wamp_ws "https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/wamp/websocket.py"
click node_wamp_auth "https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/wamp/auth.py"
click node_wamp_message "https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/wamp/message.py"
click node_wamp_serializer "https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/wamp/serializer.py"
click node_flatbuffers "https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/flatbuffers/builder.py"
click node_raw_asyncio "https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/asyncio/rawsocket.py"
click node_raw_twisted "https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/twisted/rawsocket.py"
click node_raw_core "https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/rawsocket/__init__.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_asyncio,node_twisted,node_asyncio_component,node_twisted_component toneBlue
class node_ws_protocol,node_ws_compression,node_ws_validation toneAmber
class node_wamp_session,node_wamp_protocol,node_wamp_ws,node_wamp_auth,node_wamp_message,node_router toneMint
class node_wamp_serializer,node_flatbuffers toneRose
class node_raw_asyncio,node_raw_twisted,node_raw_core,node_application,node_peer toneIndigo
```

## Components

### Runtime integrations

- [asyncio API](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/asyncio/websocket.py): `src/autobahn/asyncio/websocket.py`
- [Twisted API](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/twisted/websocket.py): `src/autobahn/twisted/websocket.py`
- [asyncio components](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/asyncio/component.py): `src/autobahn/asyncio/component.py`
- [Twisted components](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/twisted/component.py): `src/autobahn/twisted/component.py`

### WebSocket

- [WebSocket protocol](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/websocket/protocol.py): `src/autobahn/websocket/protocol.py`
- [Compression](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/websocket/compress.py): `src/autobahn/websocket/compress.py`
- [UTF-8 validation](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/websocket/utf8validator.py): `src/autobahn/websocket/utf8validator.py`

### WAMP

- [WAMP session](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/wamp/component.py): `src/autobahn/wamp/component.py`
- [WAMP protocol](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/wamp/protocol.py): `src/autobahn/wamp/protocol.py`
- [WAMP over WebSocket](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/wamp/websocket.py): `src/autobahn/wamp/websocket.py`
- [WAMP authentication](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/wamp/auth.py): `src/autobahn/wamp/auth.py`
- [WAMP messages](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/wamp/message.py): `src/autobahn/wamp/message.py`

### Serialization

- [WAMP serializers](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/wamp/serializer.py): `src/autobahn/wamp/serializer.py`
- [FlatBuffers runtime](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/flatbuffers/builder.py): `src/autobahn/flatbuffers/builder.py`

### RawSocket

- [asyncio RawSocket](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/asyncio/rawsocket.py): `src/autobahn/asyncio/rawsocket.py`
- [Twisted RawSocket](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/twisted/rawsocket.py): `src/autobahn/twisted/rawsocket.py`
- [RawSocket core](https://github.com/crossbario/autobahn-python/blob/master/src/autobahn/rawsocket/__init__.py): `src/autobahn/rawsocket/__init__.py`

### Other components

- **Application**
- **WebSocket peer**
- **WAMP router**

## Connections

- Application → asyncio API: uses
- Application → Twisted API: uses
- asyncio API → WebSocket protocol: runs protocol
- Twisted API → WebSocket protocol: runs protocol
- WebSocket protocol → WebSocket peer: exchanges frames
- WebSocket protocol → Compression: compresses messages
- WebSocket protocol → UTF-8 validation: validates text
- Application → asyncio components: creates component
- Application → Twisted components: creates component
- asyncio components → WAMP session: runs session
- Twisted components → WAMP session: runs session
- WAMP session → WAMP protocol: issues actions
- WAMP protocol → WAMP authentication: authenticates
- WAMP protocol → WAMP messages: handles messages
- WAMP protocol → WAMP serializers: serializes messages
- WAMP protocol → WAMP over WebSocket: uses transport
- WAMP over WebSocket → WebSocket protocol: carries WAMP
- WAMP over WebSocket → WAMP router: routes traffic
- WAMP serializers → FlatBuffers runtime: uses encoding
- Application → asyncio RawSocket: uses
- Application → Twisted RawSocket: uses
- asyncio RawSocket → RawSocket core: uses
- Twisted RawSocket → RawSocket core: uses
- RawSocket core → WAMP router: exchanges traffic
