Skip to content
Branch: master
Find file History
meejah and oberstet onConnecting implementation (#1170)
* first-cut of an onConnecting implementation

* add TransportDetails

* more explicit

* cleanups

* mocks

* test fixes

* clarify in docs

* pass all possible options from Factory

* tests for onConnecting

* flake8

* host, port, resource are optional

* asyncio transport_channel_id() and TransportDetails fixes from review

* only need ISSLTransport for twisted

* use fakes, not mocks

* extend example

* flake8

* documentation

* changelog entry
Latest commit 6ae03e7 Apr 19, 2019
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
asyncio onConnecting implementation (#1170) Apr 19, 2019
router
twisted onConnecting implementation (#1170) Apr 19, 2019
Makefile
README.md add note for python 3.3 users Aug 19, 2016
asciinema-autobahn-demo.py
index.html correct paths for JS links Jun 17, 2015
run-all-examples.py
running-the-examples.md Little directory correction (#1081) Nov 20, 2018

README.md

Autobahn|Python Examples

This folder contains complete working code examples that demonstrate various features of Autobahn|Python:

  1. Twisted-based Examples
  1. asyncio-based Examples

If you are new to Autobahn and WAMP, you should start with the following if you're going to use Twisted:

  • twisted/wamp/pubsub/basic/
  • twisted/wamp/rpc/arguments/

...whereas if you prefer asyncio:

  • asyncio/wamp/pubsub/basic/
  • asyncio/wamp/rpc/arguments/

Note that many of the examples use the same URIs for topics or RPC endpoints, so you can mix and match which backend or frontend script (whether Python or JavaScript) you use. For example, a Web browser tab could load a backend.html page that does publishes while you run a Python frontend.py that subscribes to those topics.

Set up locally to run the examples.

Python 3

All the examples are now using modern Python 3.5+ syntax (await and async def).

However, everything works fine with earlier syntax (yield from and @asyncio.coroutine) or with Python 2 and the "trollius" library. To use an example with older syntax, you'll have to change any await to yield from (or just yield for trollius) and change any async def to a plain def with the @asyncio.coroutine decorator.

To use trollius, additionally change import asyncio to import trollius as asyncio

For Twisted users, everything will work with Python 2.7 or Python 3 without changes.

You can’t perform that action at this time.