Package core :: Module sock_js :: Class SockJSServer

[hide private]
[frames] | no frames]

# Class SockJSServer

source code

    object --+
             |
            SockJSServer

This is an implementation of the server side part of https://github.com/sockjs

SockJS enables browsers to communicate with the server using a simple WebSocket-like api for sending and receiving messages. Under the bonnet SockJS chooses to use one of several protocols depending on browser capabilities and what apppears to be working across the network.

Available protocols include:

WebSockets xhr-polling xhr-streaming json-polling event-source html-file

This means, it should just work irrespective of what browser is being used, and whether there are nasty things like proxies and load balancers between the client and the server.

For more detailed information on SockJS, see their website.

On the server side, you interact using instances of SockJSSocket - this allows you to send data to the client or receive data via the ReadStream data_handler.

You can register multiple applications with the same SockJSServer, each using different path prefixes, each application will have its own handler, and configuration is described in a Hash.

Instance Methods | [hide private]

__init__(self, http_server) | source code

install_app(self, config, handler) Install an application | source code

bridge(self, config, inbound_permitted, outbound_permitted, auth_timeout=5*60*1000, auth_address=None) | source code

Method Details | [hide private]

### __init__(self, http_server)
(Constructor)

source code

Overrides: object.__init__
  (inherited documentation)

### install_app(self, config, handler)

source code

Install an application

Keyword arguments:

Parameters:
  - `config` - Configuration for the application
  - `proc` - Proc representing the handler
  - `handler` - Handler to call when a new SockJSSocket is created