circuits.web.websockets.dispatcher module¶
- class circuits.web.websockets.dispatcher.WebSocketsDispatcher(*args, **kwargs)¶
Bases:
BaseComponentThis class implements an RFC 6455 compliant WebSockets dispatcher that handles the WebSockets handshake and upgrades the connection.
The dispatcher listens on its channel for
Requestevents and tries to match them with a given path. Upon a match, the request is checked for the proper Opening Handshake information. If successful, the dispatcher confirms the establishment of the connection to the client. Any subsequent data from the client is handled as a WebSocket data frame, decoded and fired as aReadevent on thewschannelpassed to the constructor. The data fromwriteevents on that channel is encoded as data frames and forwarded to the client.Firing a
Closeevent on thewschannelcloses the connection in an orderly fashion (i.e. as specified by the WebSocket protocol).- Parameters:
path – the path to handle. Requests that start with this path are considered to be WebSocket Opening Handshakes.
wschannel – the channel on which
readevents from the client will be delivered and wherewriteevents to the client will be sent to.
- channel = 'web'¶
- select_subprotocol(subprotocols)¶