bwegh / erwa

Please use https://github.com/CargoTube/cargotube or https://github.com/CargoTube/ct_erwa_api instead.
MIT License
57 stars 16 forks source link

Erwa will be archived soon, please consider using CargoTube.

Erwa

passing or failing?

Erwa is an implementation of WAMP (Web Application Messaging Protocol) router in Erlang. The client/peer side has been moved to a seperate project called Awre. Both use the library Wamper.

Table of Contents

Description

Erwa is the implementation of the WAMP protocol in Erlang. It supports the router, so the server side.

Pull Requests, Bug Reports, Comments and any other kind of feedback is welcome.

Back to TOC

Features

Erwa has the following features:

Back to TOC

Router

The router implementation in Erwa uses the great ranch and cowboy from Loïc Hoguin (essen) to handle the incomming connections and the webserver part for the websockets. Erwa has two modules to work either as a protocol for ranch on incomming TCP connections, or as websocket handler with cowboy on incomming websocket connections.

All you need to do to get a simple WAMP router up and running is to add a dispatch rule to ranch and/or cowboy:

A WAMP router on websockets:

%% start erwa to handle any incomming connections to any host at the path /wamp
%% start it with 100 parallel acceptors on port 8080
ok = erwa:start_websocket("/wamp", 8080, 100).

In the examples directory you can find the simple_router which includes just the above and starts a WAMP router, including a simple javascript client, using wampy.js.

The other possibility is to start Erwa as a TCP router:

%% start erwa listening for raw tcp connections on port 5555
%% starting it with 5 parallel acceptors
ok = erwa:start_socket(5555,5).

This is also included in the simple_router example in the examples directory.

By default Erwa does not automatically create realms. This is activated by the boolean autocreate_realm flag. If you only want to support certain realm you need to start them by using erwa:start_realm/1, which takes the name of the realm to start as argument.

Back to TOC

Examples

In the exampes directory you can find a simple router example:

Back to TOC

License

The MIT License (MIT)

Copyright (c) 2014-2015 Bas Wegh

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Back to TOC

wampws