Skip to main content

Makes websockets with Mongrel2 and Python super easy

Project description

Makes handling websockets with Mongrel2 and Python easy.

This module was lovingly crafted for First Opinion.

Example

Typical websocket hello world type example, creating an echo server:

from m2websocket import Connection

conn = Connection("tcp://localhost:port", "tcp://localhost:port")

while True:
    req = conn.recv()
    conn.reply_websocket(req, req.body, req.opcode)

Yup, that’s all there is to it, much easier than this example.

You can see a working example of the echo server (with a working mongrel2 conf file and python script) by looking in the example/ directory in the Github repo.

Install it

Prerequisites

You’ll need to install the mongrel2 python library from the mongrel2 source. Once you’ve cloned the source or downloaded that folder, you can install it using setup.py

$ cd /path/to/mongrel2/src/examples/python
$ python setup.py install

Then, you can install this module using pip:

pip install m2websocket

Or:

pip install git+https://github.com/firstopinion/m2websocket#egg=m2websocket

License

MIT

Project details


Release history Release notifications

History Node

0.2.2

History Node

0.2.1

History Node

0.2

History Node

0.1.9

History Node

0.1.8

This version
History Node

0.1.7

History Node

0.1.6

History Node

0.1.5

History Node

0.1.2

History Node

0.1.1

History Node

0.1

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
m2websocket-0.1.7.tar.gz (5.6 kB) Copy SHA256 hash SHA256 Source None May 30, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page