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_frame()
    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

License

MIT

Project details


Download files

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

Source Distribution

m2websocket-0.1.1.tar.gz (5.4 kB view details)

Uploaded Source

File details

Details for the file m2websocket-0.1.1.tar.gz.

File metadata

  • Download URL: m2websocket-0.1.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for m2websocket-0.1.1.tar.gz
Algorithm Hash digest
SHA256 35bb1bdce4e547c6ad39ceec763bf25ac79e3b8d8ddc0818dab8746de38f5f21
MD5 a1031a2b4a0dac3cc188b890c52972e0
BLAKE2b-256 047a32053e063db33262bbbdc4b274de8a2e3bbf30824aded0828c3173d34cd1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page