An open API service indexing awesome lists of open source software.

https://github.com/jesus89/rainbow

Micro-framework for Python RPC+Pub/Sub over WebSockets
https://github.com/jesus89/rainbow

Last synced: 2 months ago
JSON representation

Micro-framework for Python RPC+Pub/Sub over WebSockets

Awesome Lists containing this project

README

        

![][rainbow]

[![License](http://img.shields.io/:license-gpl-blue.svg?style=flat)](http://opensource.org/licenses/GPL-2.0) [![Build Status](https://travis-ci.org/Jesus89/rainbow.svg)](https://travis-ci.org/Jesus89/rainbow)

Micro-framework for Python RPC+Pub/Sub communication over WebSockets
* Based on the [WAMP](http://wamp-proto.org/why/) protocol.
* Compatible with [JSON-RPC 2.0](http://www.jsonrpc.org/specification).
* JSON Events using the [Publish/Subscribe pattern](http://rfc.zeromq.org/spec:29).
* Syntax inspired by [Bottle](https://github.com/bottlepy/bottle).
* It includes [Avahi](http://www.avahi.org/) discovery service.

## Installation

```bash
sudo apt-get install python-dev libzmq3-dev avahi-daemon

# Disable avahi on init
sudo update-rc.d -f avahi-daemon remove

sudo pip install pyrainbow
```

## Protocol

[Rainbow protocol](doc/protocol.md)

## Description

[API description](doc/api-description.md)

## Example

Basic example

```python
from rainbow import register, run

@register
def add(a=0, b=0):
return a + b

run(host='0.0.0.0')
```

Publish example

```python
from rainbow import register, publish, run

@register
def pub():
publish('event', 'data')

run(host='0.0.0.0')
```

Check more amazing [examples](https://github.com/Jesus89/rainbow/tree/develop/examples)!

[rainbow]: doc/images/rainbow.png