# Autobahn|Python: WebSocket & WAMP for Real-Time Python Applications

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Source: osrepos.com
Repository profile: https://osrepos.com/repo/crossbario-autobahn-python
Generated for open source discovery and AI-assisted research.

Autobahn|Python is a robust open-source library providing WebSocket and WAMP implementations for Python 3.11+. It enables developers to build real-time applications with bidirectional messaging, remote procedure calls, and publish-subscribe patterns, seamlessly integrating with Twisted and asyncio frameworks.

GitHub: https://github.com/crossbario/autobahn-python
OSRepos URL: https://osrepos.com/repo/crossbario-autobahn-python

## Summary

Autobahn|Python is a robust open-source library providing WebSocket and WAMP implementations for Python 3.11+. It enables developers to build real-time applications with bidirectional messaging, remote procedure calls, and publish-subscribe patterns, seamlessly integrating with Twisted and asyncio frameworks.

## Topics

- autobahn
- websocket
- wamp
- python
- real-time
- rpc
- pubsub
- networking

## Repository Information

Last analyzed by OSRepos: Wed Jul 22 2026 20:05:26 GMT+0100 (Western European Summer Time)
Detail views: 0
GitHub clicks: 0

## Safety Notice

OSRepos shares public repositories for knowledge and discovery only. Review source code, dependencies, licenses, and security implications before running or installing anything.

## Content

## Introduction

Autobahn|Python is a powerful open-source library that provides robust implementations of the WebSocket Protocol and the Web Application Messaging Protocol (WAMP) for Python 3.11+. Designed to run on both Twisted and asyncio frameworks, it empowers developers to build high-performance, real-time applications. With Autobahn|Python, you can easily create clients and servers capable of bidirectional messaging, asynchronous Remote Procedure Calls (RPC), and Publish & Subscribe (PubSub) patterns, making it ideal for modern web and application communication.

## Installation

Getting started with Autobahn|Python is straightforward using pip.

To install the core library:

console
python -m pip install autobahn


For additional functionalities, such as advanced compression, encryption, or WAMP authentication, you can install optional dependencies:

*   **Twisted support**: `pip install autobahn[twisted]`
*   **Compression (Brotli recommended)**: `pip install autobahn[compress]`
*   **Encryption & WAMP-cryptosign**: `pip install autobahn[encryption]`
*   **WAMP-SCRAM authentication**: `pip install autobahn[scram]`
*   **Native Vector Extensions (NVX) for acceleration**: `pip install autobahn[nvx]`

## Examples

Autobahn|Python simplifies the creation of real-time components. Here are two illustrative examples:

### WebSocket Echo Server

This server echoes back any WebSocket message it receives:

python
from autobahn.twisted.websocket import WebSocketServerProtocol
# or: from autobahn.asyncio.websocket import WebSocketServerProtocol

class MyServerProtocol(WebSocketServerProtocol):

    def onConnect(self, request):
        print("Client connecting: {}".format(request.peer))

    def onOpen(self):
        print("WebSocket connection open.")

    def onMessage(self, payload, isBinary):
        if isBinary:
            print("Binary message received: {} bytes".format(len(payload)))
        else:
            print("Text message received: {}".format(payload.decode('utf8')))

        # echo back message verbatim
        self.sendMessage(payload, isBinary)

    def onClose(self, wasClean, code, reason):
        print("WebSocket connection closed: {}".format(reason))


More examples and boilerplate code for running servers can be found in the [official documentation](https://autobahn.readthedocs.io/en/latest/websocket/programming.html#running-a-server).

### WAMP Application Component

This example demonstrates a WAMP component performing subscribe, publish, register, and call actions:

python
from autobahn.twisted.wamp import ApplicationSession
# or: from autobahn.asyncio.wamp import ApplicationSession
from twisted.internet.defer import inlineCallbacks

class MyComponent(ApplicationSession):

    @inlineCallbacks
    def onJoin(self, details):

        # 1. subscribe to a topic so we receive events
        def onevent(msg):
            print("Got event: {}".format(msg))

        yield self.subscribe(onevent, 'com.myapp.hello')

        # 2. publish an event to a topic
        self.publish('com.myapp.hello', 'Hello, world!')

        # 3. register a procedure for remote calling
        def add2(x, y):
            return x + y

        self.register(add2, 'com.myapp.add2')

        # 4. call a remote procedure
        res = yield self.call('com.myapp.add2', 2, 3)
        print("Got result: {}".format(res))


For details on running WAMP application components and routers, refer to the [documentation](https://autobahn.readthedocs.io/en/latest/wamp/programming.html#running-components).

## Why Use Autobahn|Python?

Autobahn|Python stands out for its comprehensive feature set and commitment to performance and standards:

*   **Dual Framework Support**: Seamlessly integrates with both Twisted and asyncio, offering flexibility for Python developers.
*   **Full Protocol Implementation**: Provides complete, standards-compliant implementations of WebSocket (RFC6455) and WAMP.
*   **High Performance**: Features a fully asynchronous design, optional SIMD-accelerated native vector extensions (NVX) for WebSocket operations, and optimized serializers.
*   **Best-in-Class Conformance**: Achieves 100% strict passes with the Autobahn Testsuite, ensuring reliability and interoperability.
*   **Advanced Features**: Supports WebSocket compression (including Brotli), TLS for secure communication, and various WAMP authentication methods (WAMP-cryptosign, WAMP-SCRAM).
*   **Robust Packaging**: Offers comprehensive binary wheel coverage for CPython and PyPy across major platforms and architectures, ensuring easy installation without system dependencies.

## Links

Explore Autobahn|Python further with these official resources:

*   **Source Code**: [https://github.com/crossbario/autobahn-python](https://github.com/crossbario/autobahn-python)
*   **Documentation**: [https://autobahn.readthedocs.io/en/latest/](https://autobahn.readthedocs.io/en/latest/)
*   **WebSocket Examples**: [https://autobahn.readthedocs.io/en/latest/websocket/examples.html](https://autobahn.readthedocs.io/en/latest/websocket/examples.html)
*   **WAMP Examples**: [https://autobahn.readthedocs.io/en/latest/wamp/examples.html](https://autobahn.readthedocs.io/en/latest/wamp/examples.html)
*   **Community Forum**: [https://crossbar.discourse.group/](https://crossbar.discourse.group/)
*   **WAMP Protocol**: [https://wamp-proto.org/](https://wamp-proto.org/)