Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
WebSocket library for Python (ws4py). Last version 0.2.0.
Python Shell JavaScript
branch: master

This branch is 316 commits behind Lawouach:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
docs
example
test
ws4py
.gitignore
LICENSE
README.md
setup.py

README.md

WebSocket for Python (ws4py)

Python library providing support for the WebSocket protocol defined in RFC 6455 (http://tools.ietf.org/html/rfc6455).

Getting Started

Requirements

As a standalone client, ws4py only requires Python 2.6.6 or above though it hasn't been ported to Python 3.x yet.

Installing

In order to install ws4py you can either grab the source code and run:

 $ python setup.py install

Or use a package manager like pip and run:

 $ pip install git+git://github.com/Lawouach/WebSocket-for-Python.git

Documentation

Online documentation can be found at: http://www.defuze.org/oss/ws4py/docs/

Conformance

ws4py tries hard to be as conformant as it can to the specification. In order to validate this conformance, each release is run against the Autobahn testsuite (http://www.tavendo.de/autobahn) which provides an extensive converage of various aspects of the protocol.

You may try to run it against the CherryPy server as follow:

 $ python test/autobahn_test_servers.py

Then from a different terminal:

 $ cd Autobahn/testsuite/websockets
 $ python fuzzing_client.py

This will run the complete suite.

Test reports can be found at: http://www.defuze.org/oss/ws4py/testreports/servers/

Examples

ws4py comes with a few examples:

  • The echo_cherrypy_server provides a simple Echo server. It requires CherryPy 3.2.2. Once started, you can point your browser (it has been tested with Chrome 15.0.854.0). Open a couple of tabs pointing at http://localhost:9000 and chat accross those tables.
  • The droid_sensor_cherrypy_server broadcasts sensor metrics to clients. Point your browser to http://localhost:9000 Then run the droid_sensor module from your Android device using SL4A. A screenshot of what this renders to: http://www.defuze.org/oss/ws4py/screenshots/droidsensors.png

Credits

Many thanks to the pywebsocket and Tornado projects which have provided a good base to write ws4py. Thanks also to Jeff Lindsay (progrium) for the gevent server support. A well deserved thank you to Tobias Oberstein for his websocket test suite: https://github.com/oberstet/Autobahn

The background in the droid example is courtesy of http://killxthexscenexstock.deviantart.com/art/Vintage-Wall-Paper-Texture-70982719

Something went wrong with that request. Please try again.