Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Mease: Twisted/Autobahn websocket server with an easy callback registry

Project Description

Websocket server using Twisted/Autobahn with an easy to use callback registry mechanism

See django-mease, django-mease-example or flask-mease-example for working examples.


Use pip to install the latest mease version :

pip install mease

mease comes with two backends :


To use Redis backend, install these dependencies :

sudo apt-get install redis-server
pip install redis

Refer to the Redis documentation to configure your server.


To use RabbitMQ backend, install these dependencies :

sudo apt-get install rabbitmq-server
pip install kombu

Refer to the RabbitMQ documentation to configure your server.


Create a file where you can write your callbacks and register them :

from mease import Mease
from mease.backends.redis import RedisBackend
# OR from mease.backends.rabbitmq import RabbitMQBackend

from uuid import uuid4

mease = Mease(RedisBackend)

def example_opener(client, clients_list):
    # Do stuff on client connection['uuid'] = str(uuid4())

def example_closer(client, clients_list):
    # Do stuff on client disconnection
    print("Client {uuid} disconnected".format('uuid')))

def example_receiver(client, clients_list, message):
    # Do stuff on incoming client message

def example_sender(routing, clients_list, my_tuple):
    # Do stuff on outgoing message

if __name__ == '__main__':
    # Start websocket server

Remember to run the websocket server from the mease instance where you registered your callbacks.

In your code, you can now call the mease publish method to send a message to websocket clients :

from mease import Mease
from mease.backends.redis import RedisBackend

mease = Mease(RedisBackend)

# ...

mease.publish('mease.demo', my_tuple=("Hello", "World"))

That’s it ! You are now able to send messages from your web server to your websocket server in a cool way !

Release History

Release History

This version
History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
mease-0.2.0.tar.gz (8.8 kB) Copy SHA256 Checksum SHA256 Source Feb 3, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting