wamp-tessel
wamp-tessel is an open-source implementation of the Web Application Messaging Protocol V2 specifically intended to run on the Tessel microcontroller. This project is a stripped-down version of Autobahn|JS, a subproject of the Autobahn project.
Autobahn|JS is a robust library that can run in multiple environments, including web browsers and in NodeJS, but it can not be used on Tessel because of its large size (by microcontroller standards) and its use of unsupported libraries.
wamp-tessel differs most notably from Autobahn|JS in these ways:
- It is compatible with the Tessel microcontroller;
- It is NOT compatible with web browser environments;
- The only supported transport is WebSockets;
- It supports only the WAMP Basic Profile - no encryption or other Advanced Profile features are supported.
It is licensed under the MIT license.
Show me some code
The following example implements all four roles that Autobahn|JS (and hence wamp-tessel) offers
- Publisher
- Subscriber
- Caller (calls a remote procedure)
- Callee (offers a remote procedure)
The code runs as part of your Tessel project in Node.js!
var wamp = ; var connection = url: 'ws://127.0.0.1:9000/' realm: 'realm1'; connection { // 1) subscribe to a topic { console; } session; // 2) publish an event session; // 3) register a procedure for remoting { return args0 + args1; } session; // 4) call a remote procedure session;}; connection;
Get it
wamp-tessel is available via the Node package manager here. To install:
npm install wamp-tessel
More information
For more information, have a look at the Autobahn|JS project documentation. This provides:
- a quick 'Getting Started'
- tutorials on RPC and PubSub
- a list of all examples in this repo
- a full API reference
Acknowledgements
wamp-tessel is essentially a stripped-down version of Autobahn|JS, a subproject of the Autobahn project. If you want to learn more about how WAMP (or this library!) works, you should check out that project.