Files
Tobias Oberstein 0af895bff0 Newapi asyncio component (#872)
* start of asyncio side of component API

* copy-pasta the authentication stuff for now

* add 'trust_root' to TLS config, fix generic component errors

* change MyAuthorizer to match component examples

* new certificate; expired

* move auth code to central place, refactor general new-Session code

* fixes to asyncio, unix, some flake8

* refactor authentication API

add_authenticator now takes an instance of IAuthenticator
that we construct with a factory function

* unused imports

* no qa on invalid syntax for py 2
2017-07-19 14:15:26 +02:00
..
2017-07-19 14:15:26 +02:00
2017-07-19 14:15:26 +02:00
2017-07-19 14:15:26 +02:00
2016-05-01 18:11:06 +02:00
2015-06-17 14:37:14 -06:00
2016-08-19 15:02:33 -06:00
2017-06-10 12:48:14 +02:00

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.