autobahn.twisted.websocket¶
Classes¶
Twisted-based WAMP-over-WebSocket client protocol factory. |
|
Twisted-based WAMP-over-WebSocket client protocol. |
|
Twisted-based WAMP-over-WebSocket server protocol factory. |
|
Twisted-based WAMP-over-WebSocket server protocol. |
|
Adapter class for Twisted-based WebSocket client and server factories. |
|
Adapter class for Twisted WebSocket client and server protocols. |
|
Base class for Twisted-based WebSocket client factories. |
|
Base class for Twisted-based WebSocket client protocols. |
|
Base class for Twisted-based WebSocket server factories. |
|
Base class for Twisted-based WebSocket server protocols. |
|
An adapter for stream-based transport over WebSocket. |
|
Wrapping client factory for stream-based transport over WebSocket. |
|
Client protocol for stream-based transport over WebSocket. |
|
Wrapping server factory for stream-based transport over WebSocket. |
|
Server protocol for stream-based transport over WebSocket. |
Functions¶
|
Establish WebSocket connection to a server. The connection parameters like target |
|
|
|
Listen for incoming WebSocket connections from clients. The connection parameters like |
Module Contents¶
- class WampWebSocketClientFactory(factory, *args, **kwargs)[source]¶
Bases:
autobahn.wamp.websocket.WampWebSocketClientFactory,WebSocketClientFactoryTwisted-based WAMP-over-WebSocket client protocol factory.
- protocol[source]¶
The protocol to be spoken. Must be derived from
autobahn.websocket.protocol.WebSocketClientProtocol.
- class WampWebSocketClientProtocol[source]¶
Bases:
autobahn.wamp.websocket.WampWebSocketClientProtocol,WebSocketClientProtocolTwisted-based WAMP-over-WebSocket client protocol.
Implements:
- class WampWebSocketServerFactory(factory, *args, **kwargs)[source]¶
Bases:
autobahn.wamp.websocket.WampWebSocketServerFactory,WebSocketServerFactoryTwisted-based WAMP-over-WebSocket server protocol factory.
- protocol[source]¶
The protocol to be spoken. Must be derived from
autobahn.websocket.protocol.WebSocketServerProtocol.
- class WampWebSocketServerProtocol[source]¶
Bases:
autobahn.wamp.websocket.WampWebSocketServerProtocol,WebSocketServerProtocolTwisted-based WAMP-over-WebSocket server protocol.
Implements:
- class WebSocketAdapterFactory[source]¶
Bases:
objectAdapter class for Twisted-based WebSocket client and server factories.
- class WebSocketAdapterProtocol[source]¶
Bases:
twisted.internet.protocol.ProtocolAdapter class for Twisted WebSocket client and server protocols.
Called from Twisted:
autobahn.twisted.websocket.WebSocketAdapterProtocol.connectionMade()autobahn.twisted.websocket.WebSocketAdapterProtocol.connectionLost()autobahn.twisted.websocket.WebSocketAdapterProtocol.dataReceived()
Called from Network-independent Code (WebSocket implementation):
autobahn.twisted.websocket.WebSocketAdapterProtocol._onOpen()autobahn.twisted.websocket.WebSocketAdapterProtocol._onMessageBegin()autobahn.twisted.websocket.WebSocketAdapterProtocol._onMessageFrameData()autobahn.twisted.websocket.WebSocketAdapterProtocol._onMessageFrameEnd()autobahn.twisted.websocket.WebSocketAdapterProtocol._onMessageEnd()autobahn.twisted.websocket.WebSocketAdapterProtocol._onMessage()autobahn.twisted.websocket.WebSocketAdapterProtocol._onPing()autobahn.twisted.websocket.WebSocketAdapterProtocol._onPong()autobahn.twisted.websocket.WebSocketAdapterProtocol._onClose()
FIXME:
autobahn.twisted.websocket.WebSocketAdapterProtocol._closeConnection()autobahn.twisted.websocket.WebSocketAdapterProtocol._create_transport_details()autobahn.twisted.websocket.WebSocketAdapterProtocol.registerProducer()autobahn.twisted.websocket.WebSocketAdapterProtocol.unregisterProducer()
- class WebSocketClientFactory(*args, **kwargs)[source]¶
Bases:
WebSocketAdapterFactory,autobahn.websocket.protocol.WebSocketClientFactory,twisted.internet.protocol.ClientFactoryBase class for Twisted-based WebSocket client factories.
Implements
autobahn.websocket.interfaces.IWebSocketClientChannelFactory
- class WebSocketClientProtocol[source]¶
Bases:
WebSocketAdapterProtocol,autobahn.websocket.protocol.WebSocketClientProtocolBase class for Twisted-based WebSocket client protocols.
Implements
autobahn.websocket.interfaces.IWebSocketChannel.- _onConnect(response: autobahn.websocket.types.ConnectionResponse)[source]¶
- class WebSocketServerFactory(*args, **kwargs)[source]¶
Bases:
WebSocketAdapterFactory,autobahn.websocket.protocol.WebSocketServerFactory,twisted.internet.protocol.ServerFactoryBase class for Twisted-based WebSocket server factories.
Implements
autobahn.websocket.interfaces.IWebSocketServerChannelFactory
- class WebSocketServerProtocol[source]¶
Bases:
WebSocketAdapterProtocol,autobahn.websocket.protocol.WebSocketServerProtocolBase class for Twisted-based WebSocket server protocols.
Implements
autobahn.websocket.interfaces.IWebSocketChannel.
- class WrappingWebSocketAdapter[source]¶
Bases:
objectAn adapter for stream-based transport over WebSocket.
This follows websockify and should be compatible with that.
It uses WebSocket subprotocol negotiation and supports the following WebSocket subprotocols:
binary(or a compatible subprotocol)base64
Octets are either transmitted as the payload of WebSocket binary messages when using the
binarysubprotocol (or an alternative binary compatible subprotocol), or encoded with Base64 and then transmitted as the payload of WebSocket text messages when using thebase64subprotocol.
- class WrappingWebSocketClientFactory(factory, url, reactor=None, enableCompression=True, autoFragmentSize=0, subprotocol=None)[source]¶
Bases:
WebSocketClientFactoryWrapping client factory for stream-based transport over WebSocket.
- class WrappingWebSocketClientProtocol[source]¶
Bases:
WrappingWebSocketAdapter,WebSocketClientProtocolClient protocol for stream-based transport over WebSocket.
- class WrappingWebSocketServerFactory(factory, url, reactor=None, enableCompression=True, autoFragmentSize=0, subprotocol=None)[source]¶
Bases:
WebSocketServerFactoryWrapping server factory for stream-based transport over WebSocket.
- class WrappingWebSocketServerProtocol[source]¶
Bases:
WrappingWebSocketAdapter,WebSocketServerProtocolServer protocol for stream-based transport over WebSocket.
- connectWS(factory, contextFactory=None, timeout=30, bindAddress=None)[source]¶
Establish WebSocket connection to a server. The connection parameters like target host, port, resource and others are provided via the factory.
- Parameters:
factory (An
autobahn.websocket.WebSocketClientFactoryinstance.) – The WebSocket protocol factory to be used for creating client protocol instances.contextFactory (A twisted.internet.ssl.ClientContextFactory instance.) – SSL context factory, required for secure WebSocket connections (“wss”).
timeout (int) – Number of seconds to wait before assuming the connection has failed.
bindAddress (tuple) – A (host, port) tuple of local address to bind to, or None.
- Returns:
The connector.
- Return type:
An object which implements twisted.interface.IConnector.
- listenWS(factory, contextFactory=None, backlog=50, interface='')[source]¶
Listen for incoming WebSocket connections from clients. The connection parameters like listening port and others are provided via the factory.
- Parameters:
factory (An
autobahn.websocket.WebSocketServerFactoryinstance.) – The WebSocket protocol factory to be used for creating server protocol instances.contextFactory (A twisted.internet.ssl.ContextFactory.) – SSL context factory, required for secure WebSocket connections (“wss”).
backlog (int) – Size of the listen queue.
interface (str) – The interface (derived from hostname given) to bind to, defaults to ‘’ (all).
- Returns:
The listening port.
- Return type:
An object that implements twisted.interface.IListeningPort.