{"name":"Autobahn|Python: WebSocket & WAMP for Real-Time Python Applications","description":"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","url":"https://osrepos.com/repo/crossbario-autobahn-python","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/crossbario-autobahn-python","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/crossbario-autobahn-python.md","json":"https://osrepos.com/repo/crossbario-autobahn-python.json","topics":["autobahn","websocket","wamp","python","real-time","rpc","pubsub","networking"],"keywords":["autobahn","websocket","wamp","python","real-time","rpc","pubsub","networking"],"stars":null,"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.","content":"## Introduction\n\nAutobahn|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.\n\n## Installation\n\nGetting started with Autobahn|Python is straightforward using pip.\n\nTo install the core library:\n\nconsole\npython -m pip install autobahn\n\n\nFor additional functionalities, such as advanced compression, encryption, or WAMP authentication, you can install optional dependencies:\n\n*   **Twisted support**: `pip install autobahn[twisted]`\n*   **Compression (Brotli recommended)**: `pip install autobahn[compress]`\n*   **Encryption & WAMP-cryptosign**: `pip install autobahn[encryption]`\n*   **WAMP-SCRAM authentication**: `pip install autobahn[scram]`\n*   **Native Vector Extensions (NVX) for acceleration**: `pip install autobahn[nvx]`\n\n## Examples\n\nAutobahn|Python simplifies the creation of real-time components. Here are two illustrative examples:\n\n### WebSocket Echo Server\n\nThis server echoes back any WebSocket message it receives:\n\npython\nfrom autobahn.twisted.websocket import WebSocketServerProtocol\n# or: from autobahn.asyncio.websocket import WebSocketServerProtocol\n\nclass MyServerProtocol(WebSocketServerProtocol):\n\n    def onConnect(self, request):\n        print(\"Client connecting: {}\".format(request.peer))\n\n    def onOpen(self):\n        print(\"WebSocket connection open.\")\n\n    def onMessage(self, payload, isBinary):\n        if isBinary:\n            print(\"Binary message received: {} bytes\".format(len(payload)))\n        else:\n            print(\"Text message received: {}\".format(payload.decode('utf8')))\n\n        # echo back message verbatim\n        self.sendMessage(payload, isBinary)\n\n    def onClose(self, wasClean, code, reason):\n        print(\"WebSocket connection closed: {}\".format(reason))\n\n\nMore 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).\n\n### WAMP Application Component\n\nThis example demonstrates a WAMP component performing subscribe, publish, register, and call actions:\n\npython\nfrom autobahn.twisted.wamp import ApplicationSession\n# or: from autobahn.asyncio.wamp import ApplicationSession\nfrom twisted.internet.defer import inlineCallbacks\n\nclass MyComponent(ApplicationSession):\n\n    @inlineCallbacks\n    def onJoin(self, details):\n\n        # 1. subscribe to a topic so we receive events\n        def onevent(msg):\n            print(\"Got event: {}\".format(msg))\n\n        yield self.subscribe(onevent, 'com.myapp.hello')\n\n        # 2. publish an event to a topic\n        self.publish('com.myapp.hello', 'Hello, world!')\n\n        # 3. register a procedure for remote calling\n        def add2(x, y):\n            return x + y\n\n        self.register(add2, 'com.myapp.add2')\n\n        # 4. call a remote procedure\n        res = yield self.call('com.myapp.add2', 2, 3)\n        print(\"Got result: {}\".format(res))\n\n\nFor details on running WAMP application components and routers, refer to the [documentation](https://autobahn.readthedocs.io/en/latest/wamp/programming.html#running-components).\n\n## Why Use Autobahn|Python?\n\nAutobahn|Python stands out for its comprehensive feature set and commitment to performance and standards:\n\n*   **Dual Framework Support**: Seamlessly integrates with both Twisted and asyncio, offering flexibility for Python developers.\n*   **Full Protocol Implementation**: Provides complete, standards-compliant implementations of WebSocket (RFC6455) and WAMP.\n*   **High Performance**: Features a fully asynchronous design, optional SIMD-accelerated native vector extensions (NVX) for WebSocket operations, and optimized serializers.\n*   **Best-in-Class Conformance**: Achieves 100% strict passes with the Autobahn Testsuite, ensuring reliability and interoperability.\n*   **Advanced Features**: Supports WebSocket compression (including Brotli), TLS for secure communication, and various WAMP authentication methods (WAMP-cryptosign, WAMP-SCRAM).\n*   **Robust Packaging**: Offers comprehensive binary wheel coverage for CPython and PyPy across major platforms and architectures, ensuring easy installation without system dependencies.\n\n## Links\n\nExplore Autobahn|Python further with these official resources:\n\n*   **Source Code**: [https://github.com/crossbario/autobahn-python](https://github.com/crossbario/autobahn-python)\n*   **Documentation**: [https://autobahn.readthedocs.io/en/latest/](https://autobahn.readthedocs.io/en/latest/)\n*   **WebSocket Examples**: [https://autobahn.readthedocs.io/en/latest/websocket/examples.html](https://autobahn.readthedocs.io/en/latest/websocket/examples.html)\n*   **WAMP Examples**: [https://autobahn.readthedocs.io/en/latest/wamp/examples.html](https://autobahn.readthedocs.io/en/latest/wamp/examples.html)\n*   **Community Forum**: [https://crossbar.discourse.group/](https://crossbar.discourse.group/)\n*   **WAMP Protocol**: [https://wamp-proto.org/](https://wamp-proto.org/)","metrics":{"detailViews":0,"githubClicks":0},"dates":{"published":null,"modified":"2026-07-22T19:05:26.000Z"}}