skip to navigation
skip to content

pyramid_sockjs 0.3.4

SockJS server implementation for Pyramid.

Latest Version: 0.3.9


pyramid_sockjs is a gevent-based SockJS integration for Pyramid. SockJS interface is implemented as a pyramid route. pyramid_sockjs runs inside a WSGI application rather than WSGI server. This means all of your previous WSGI/Pyramid experience will be relevant. Its possible to create any number of different sockjs routes, ie /__sockjs__/* or /mycustom-sockjs/*. You can provide different session implementation and management for each sockjs route.

Gevent based server is required for pyramid_sockjs. For example gunicorn with gevent worker. pyramid_sockjs provides simple gevent based paster server runner:

use = egg:pyramid_sockjs#server
host =
port = 8080

Example of sockjs route:

def main(global_settings, **settings):
    config = Configurator(settings=settings)

    return config.make_wsgi_app()

Client side code:

<script src=""></script>
    var sock = new SockJS('http://localhost:8080/__sockjs__');

    sock.onopen = function() {

    sock.onmessage = function(obj) {

    sock.onclose = function() {


  1. Install virtualenv:

    $ wget
    $ python2.7 ./ --no-site-packages sockjs
  2. Install gevent 1.0b2 (non-Windows):

    $ ./sockjs/bin/pip install
  1. Install gevent 1.0b2 (Windows, 32bit Python 2.7):

    $ ./sockjs/Scripts/easy_install
  2. Clone pyramid_sockjs from github and then install:

    $ git clone git://
    $ cd pyramid_sockjs
    $ ../sockjs/bin/python develop

To run chat example use following command:

$ ./sockjs/bin/python ./pyramid_sockjs/examples/

Supported transports


Pyramid sockjs does not support multple websocket session with same session id.

gevent does not support Python 3


You can find several examples in the pyramid_sockjs repository at github.


pyramid_sockjs is offered under the MIT license.


0.3.4 (2012-05-06)

  • Fixed datetime serialization, assume all datetime objects in utc tz.

0.3.3 (2012-05-02)

  • Pass request to session factory

0.3.2 (2012-04-02)

  • Make ‘cookie_needed’ is configuration option
  • Update sockjs-protocol 0.3

0.3.1 (2012-03-27)

  • Fixed python2.6 compatibility. See #1

0.3.0 (2012-03-26)

  • Hixie 75/76 websocket protocol added

0.2.1 (2012-03-20)

  • Fixed websocket frame with ‘[]’
  • Update cors headers for dev protocol compliance

0.2 (2012-03-16)

  • Fixed ujson support

0.1 (2012-02-23)

  • Initial release
File Type Py Version Uploaded on Size
pyramid_sockjs-0.3.4.tar.gz (md5) Source 2012-05-06 58KB