Crossbar.io Examples
This repository contains example code and applications for Crossbar.io.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
.
Getting started
If you are new here, we recommend you to start with our Getting started page.
Overview of Examples
This overview may not be complete - so check the repository listing if you're looking for something not listed here.
To give you a better idea of a small working WAMP application there is
- Hello with backends for the following languages/WAMP client libraries
For a slightly more complex (and realistic) application:
- Votes - basic WAMP application using both PubSub and RPC, with a Web frontend. Comes with backends for
The following examples cover specific features of WAMP/Crossbar.io
-
Authentication and its Documentation
-
Authorization and its Documentation
-
Event history Event history is a feature of the WAMP Advanced Profile and allows subscribers to catch up on missed events when reconnecting or to generally retrieve event history on subscriptions.
-
Exclude Subscribers This example shows several ways to exclude subscribers from getting a subscription.
-
File upload with Crossbar This example shows how to use Crossbar.io web server with file upload.
-
Flash Fallback - How to use Flash fallback for older browsers without WebSocket support (mainly there for IE<10)
-
Longpoll - How to use the Longpoll fallback for older browsers without WebSocket support
-
Metaapi - How to subscribe to meta-events and use meta-procedures (get information about sessions, subscriptions and registrations)
-
Pattern-based Registrations - This example illustrates pattern-based registrations.
-
Pattern-based Registrations - This example illustrates pattern-based subscriptions.
-
Payloadcodec - Setting up serialization of custom types in Crossbar.io
-
Prompt - Getting user input asynchronously
-
Scaling-Microservices - Transparent scaling of microservices
-
Serializers - Configuring serializers in Crossbar.io
-
Shared Registeration - With shared registrations, multiple components can register the same procedure.
-
Universal Transport - The universal transport allows to service multiple protocols on one listening endpoint, such as the default TLS listening port: WAMP-over-RawSocket,WAMP-over-WebSocket,Web Resources
And finally, there are examples using specific devices or technologies:
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 very welcome to adapt example code for other languages.
Similarly, you're welcome to add examples that you think provide value to other users.
To do either, just send us a pull request.
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. The chance of running across an outdated example here are higher, however. Should you find such an example, please file an issue (or fix it and send us a pull request).