/autobahn-python

WebSocket and WAMP in Python for Twisted and asyncio

Primary LanguagePythonMIT LicenseMIT

Autobahn|Python

WebSocket & WAMP for Python on Twisted and asyncio.

Version Build Status Coverage Docs

Quick Links: Source Code - Documentation - WebSocket Examples - WAMP Examples
Community: Mailing list - StackOverflow - Twitter - IRC #autobahn/chat.freenode.net
Companion Projects: Autobahn|JS - Autobahn|Cpp - Autobahn|Testsuite - Crossbar.io - WAMP

Introduction

Autobahn|Python is a subproject of Autobahn and provides open-source implementations of

for Python 2 and 3, and running on Twisted and asyncio.

You can use Autobahn|Python to create clients and servers in Python speaking just plain WebSocket or WAMP.

WebSocket allows bidirectional real-time messaging on the Web and beyond, while WAMP adds real-time application communication on top of WebSocket.

WAMP provides asynchronous Remote Procedure Calls and Publish & Subscribe for applications in one protocol running over WebSocket. WAMP is a routed protocol, so you need a WAMP Router to connect your Autobahn|Python based clients. We provide Crossbar.io, but there are other options as well.

Features

Show me some code

To give you a first impression, here are two examples. We have lot more in the repo.

WebSocket Echo Server

Here is a simple WebSocket Echo Server that will echo back any WebSocket message received:

To actually run above server protocol, you need some lines of boilerplate.

WAMP Application Component

Here is a WAMP Application Component that performs all four types of actions that WAMP provides:

  1. subscribe to a topic
  2. publish an event
  3. register a procedure
  4. call a procedure

Above code will work on Twisted and asyncio by changing a single line (the base class of MyComponent). To actually run above application component, you need some lines of boilerplate and a WAMP Router.