diff --git a/examples/README.md b/examples/README.md index 84336e0e..b64bf58f 100644 --- a/examples/README.md +++ b/examples/README.md @@ -3,12 +3,12 @@ This folder contains complete working code examples that demonstrate various features of **Autobahn**|Python: 1. **Twisted**-based Examples - * [WebSocket](twisted/websocket) - * [WAMP](twisted/wamp) + * [WebSocket](twisted/websocket/README.md) + * [WAMP](twisted/wamp/README.md) 2. **asyncio**-based Examples - * [WebSocket](asyncio/websocket) - * [WAMP](asyncio/wamp) + * [WebSocket](asyncio/websocket/README.md) + * [WAMP](asyncio/wamp/README.md) If you are new to Autobahn and WAMP, you should start with the following if you're going to use Twisted: diff --git a/examples/index.html b/examples/index.html index 2ee20d8a..75b652d1 100644 --- a/examples/index.html +++ b/examples/index.html @@ -2,9 +2,8 @@ This is here to facilitate using the examples when running your own -local Crossbar instance; see the README for how to configure your -crossbar.io instance to point the root of its static Web directory at -the directory this file is in. +local Crossbar instance; see running-the-examples.md for instructions +on running a local crossbar.io instance. diff --git a/examples/running-the-examples.md b/examples/running-the-examples.md index a1e819b8..7e7ac066 100644 --- a/examples/running-the-examples.md +++ b/examples/running-the-examples.md @@ -4,7 +4,7 @@ To run the following examples, you need a WAMP router. -By default, **all examples are set up to use a a local Crossbar instance**. You can change the URI used with the environment variable AUTOBAHN_DEMO_ROUTER (by default it is `ws://localhost:8080/ws`). Please see [Running Crossbar Locally] below. +By default, **all examples are set up to use a local Crossbar instance**. You can change the URI used with the environment variable AUTOBAHN_DEMO_ROUTER (by default it is `ws://localhost:8080/ws`). Please see [Running Crossbar Locally] below. ## Creating a virtualenv @@ -12,7 +12,8 @@ By default, **all examples are set up to use a a local Crossbar instance**. You If you do not yet have a `virtualenv` to run the examples with, you can do something like: ```shell -cd ./autobahn-clone/ +git clone https://github.com/tavendo/AutobahnPython.git +cd ./AutobahnPython/ virtualenv venv-autobahn source venv-autobahn/bin/activate pip install -e ./ @@ -55,7 +56,7 @@ If you want to use your own local [Crossbar](http://crossbar.io) instance you mu Once you have crossbar installed, use the provided router configuration in `examples/router/.crossbar/config.json`. Starting your router is then: ```shell -cd examples/router +cd ./examples/router crossbar start ``` diff --git a/examples/twisted/wamp/README.md b/examples/twisted/wamp/README.md index d8ba1213..89112cbb 100644 --- a/examples/twisted/wamp/README.md +++ b/examples/twisted/wamp/README.md @@ -10,35 +10,38 @@ There are several very-similar examples that each follow a similar form and demo Note that any WAMP component can "do" all the roles (so a "backend" component can easily also call endpoints or listen for events) but we needed to separate things somehow. However, you can organize your components however you see fit. +For examples using RPC, you need to run the backend first, so that procedures are registered and available to call. -## Simple Examples +## The Examples -1. RPC - * [Arguments](rpc/arguments) - * [Complex](rpc/complex) - * [Decorators](rpc/decorators) - * [Errors](rpc/errors) - * [Options](rpc/options) - * [Progress](rpc/progress) - * [Slow Square](rpc/slowsquare) - * [Time Service](rpc/timeservice) +### RPC Examples -2. PubSub - * [Basic](pubsub/basic) - * [Complex](pubsub/complex) - * [Decorators](pubsub/decorators) - * [Options](pubsub/options) - * [Unsubscribe](pubsub/unsubscribe) + * [Arguments](rpc/arguments): different types of argument-passing + * [Complex](rpc/complex): complex return types + * [Decorators](rpc/decorators): register RPC methods using decorators + * [Errors](rpc/errors): map custom error classes to WAMP URIs + * [Options](rpc/options): show some RegistrationOptions and CallOptions use + * [Progress](rpc/progress): progressive results for long-running oprations + * [Slow Square](rpc/slowsquare): an RPC call that takes some time + * [Time Service](rpc/timeservice): XXX delete? -There also some more "real" examples, implemented as pluggable "WAMPlets". These also serve as skeletons to base your own WAMPlets from, should you wish to package components as illustrated. +### PubSub Examples -3. Vote Game [votegame](wamplet/votegame) + * [Basic](pubsub/basic): publish to a topic once per second + * [Complex](pubsub/complex): demonstrates different payload arguments + * [Decorators](pubsub/decorators): doing subscriptions with decorators + * [Options](pubsub/options): use of PublishOptions and SubscribeOptions + * [Unsubscribe](pubsub/unsubscribe): listen to events for a limited time -A collaborative voting "game" to decide the most amazing fruit. +There also some larger examples, implemented as pluggable "WAMPlets". These can also serve as skeletons to base your own WAMPlets from, should you wish to package components like this. -4. IRC Bot [wampirc](wamplet/wampirc) +### Vote Game -Basically shows some simple bridging between IRC and WAMP, exporting private messages to the bot as WAMP publish()es. +The [votegame](wamplet/votegame) example is a collaborative voting "game" to decide the most amazing fruit. Updates votes amongst all clients in realtime. + +### IRC Bot + +The [wampirc](wamplet/wampirc) example shows some simple bridging between IRC and WAMP, exporting private messages to the bot as WAMP publish()-es. ## How to run