Examples

Working code is the best documentation

Working code is in itself proof that what you see is not outdated, doesn’t have any typos, or suffers from any other problems that written documentation may have.

We provide code examples for various features of Crossbar.io in the examples repository. It’s always a good idea to check this when you run into any problems

Using the examples

The examples are self-contained and ready to run. Each of the example directories contains an Crossbar.io configuration. In order to run the example, just got to its directory and do crossbar start.

Overview of Examples

This overview may not be complete - see the actual repository if you’re looking for something not listed here!

To give you a better idea of a small working WAMP application there is

For a slightly more compley (and realistic) application:

There are examples covering specific features of WAMP/Crossbar.io, e.g.

There are examples using specific technologies:

There is also an entire subsection for the IoT, for which we also offer documentation.

And, finally, there are more demos in the vein of the votes app. These range from really old code (written for a precursor version of Crossbar.io - so beware not to take this as examples!) to newer stuff, illustrating some of the things you can do with Crossbar.io.

Adapting for other languages

Most of the examples are for Python and JavaScript, even though often what is shown would work with other languages and WAMP client libraries. This is purely due to lack of resources. We want you to use Crossbar.io with whatever language or languages you want.

Anybody is highly welcome to adapt example code for other languages.

Similarly, you’re welcome to add examples that you think provide value to other users.

Keeping things up to date

As you’ll probably notice sooner or later, Crossbar.io is a work in progress. Core functionality is stable, but there is a lot of development going on around it. We try to keep these examples working. If you find that something is broken, then please file an issue (or fix it and send us a pull request).

Additional Examples

For historic reasons, the Autobahn|Python repository also contains some examples for using WAMP. The most relevant to the general Crossbar.io user can be found in this directory. These are almost always for both Python and JavaScript (using Autobahn|JS).

Some of the instructions here still assume a basic router in Autobahn|Python which has since been removed, but in principle they should run with Crossbar.io. Chances to happen across an outdated example are higher here, however. Should you find such an example, then please file an issue (or fix it and send us a pull request).