WebSocket support for pyramid is implemented as a view which handles the upgrade request and a resource which manages the persistent connected clients. Both should be subclassed to provide send and receive functionality desired
Custom predicate to denote a websocket handshake
See [predicate_arguments] and the custom_predicate key word argument to repoze.bfg.configuration.Configurator.add_view()
WebSocketView and WebSocketAwareResource are also available in this namespace, and this is the prefered location to use them from
This module supplies a class which can be subclassed or mixed in and used in conjunction with WebSocketView. It provides functionality for adding and removing websockets as listeners for events
An object in a pyramid:traversal graph that handles websockets
It is designed to be persistent and to route messages to attached clients
Adds a eventlet.websocket.WebSocket the the set of listeners
A set of attached websockets
Removes ws from the set of listeners
Exception to use in place of an assertion error
A view for handling websockets
This view handles both the upgrade request and the ongoing socket communiction.
Completes the upgrade request sent by the browser
Sends the headers required to set up to websocket connection back to the browser and then hands off to handle_websocket().
Returns: | webob.exc.HTTPBadRequest if handshake fails |
---|
This module provides a paste [server_factory] to run pyramid inside an eventlet wsgi server
See Paste Deploy for more details.
Implements the [server_factory] api to provide an eventlet wsgi server
The handshake module contains implementations of different websocket spec versions’ handshakes.
The WebSocket spec had a major revision at version 76 [ws76] on May 6th 2010. This module is an attempt to insulate downstream application programmers from those changes
Raised when the handshake fails
Raised when the websocket request doesn’t have a valid origin
Construct a websocket url for given headers
Parameters: | headers – webob.headers.EnvironHeaders |
---|
The websocket handshake as described in version 75 of the spec [ws75]
Parameters: |
|
---|
The websocket handshake as described in version 76 of the spec [ws76]
Parameters: |
|
---|
Perform the websocket handshake
This function does the part of the handshake that is common across spec versions and then hands off to the spec specific implementations.
See: handshake_pre76()
Parameters: | headers (webob.headers.EnvironHeaders) – The websocket upgrade request headers (headers attribute from webob.Request) |
---|---|
Raises : | HandShakeFailed, InvalidOrigin |
Returns: | A string to send back to the client |
References
[server_factory] | (1, 2) http://pythonpaste.org/deploy/#paste-server-factory |
[websocket_protocol] | http://en.wikipedia.org/wiki/Web_Sockets#WebSocket_Protocol_Handshake |
[predicate_arguments] | http://docs.repoze.org/bfg/1.3/narr/views.html#predicate-arguments |