socketio.transports
¶
This is largely an internal module, responsible for translating the different fallback mechanisms to one abstracted Socket, dealing with payload encoding, multi-message multiplexing and their reverse operation.
- class socketio.transports.BaseTransport(handler, config, **kwargs)[source]¶
Bases:
object
Base class for all transports. Mostly wraps handler class functions.
- class socketio.transports.FlashSocketTransport(handler, config, **kwargs)[source]¶
Bases:
WebsocketTransport
- class socketio.transports.HTMLFileTransport(handler, config)[source]¶
Bases:
XHRPollingTransport
Not tested at all!
- class socketio.transports.JSONPolling(handler, config)[source]¶
Bases:
XHRPollingTransport
- class socketio.transports.WebsocketTransport(handler, config, **kwargs)[source]¶
Bases:
BaseTransport
- class socketio.transports.XHRMultipartTransport(handler)[source]¶
Bases:
XHRPollingTransport
- class socketio.transports.XHRPollingTransport(*args, **kwargs)[source]¶
Bases:
BaseTransport
- decode_payload(payload)[source]¶
This function can extract multiple messages from one HTTP payload. Some times, the XHR/JSONP/.. transports can pack more than one message on a single packet. They are encoding following the WebSocket semantics, which need to be reproduced here to unwrap the messages.
The semantics are:
ufffd + [length as a string] + ufffd + [payload as a unicode string]
This function returns a list of messages, even though there is only one.
Inspired by socket.io/lib/transports/http.js
- encode_payload(messages)[source]¶
Encode list of messages. Expects messages to be unicode.
messages
- List of raw messages to encode, if necessary