crossbar.router.unisocket

Classes

Module Contents

class UniSocketServerFactory(web_factory=None, websocket_factory_map=None, rawsocket_factory=None, mqtt_factory=None)[source]

Bases: twisted.internet.protocol.Factory

_mqtt_factory = None[source]
_rawsocket_factory = None[source]
_web_factory = None[source]
_websocket_factory_map = None[source]
acceptableProtocols()[source]

Protocols this server can speak.

buildProtocol(addr)[source]

Create an instance of a subclass of Protocol.

The returned instance will handle input on an incoming server connection, and an attribute “factory” pointing to the creating factory.

Alternatively, L{None} may be returned to immediately close the new connection.

Override this method to alter how Protocol instances get created.

@param addr: an object implementing L{IAddress}

noisy = False[source]
class UniSocketServerProtocol(factory, addr)[source]

Bases: twisted.internet.protocol.Protocol

_addr[source]
_data = b''[source]
_factory[source]
_proto = None[source]
connectionLost(reason)[source]

Called when the connection is shut down.

Clear any circular references here, and any external references to this Protocol. The connection has been closed.

@type reason: L{twisted.python.failure.Failure}

dataReceived(data)[source]

Called whenever data is received.

Use this method to translate to a higher-level message. Usually, some callback will be made upon the receipt of each complete protocol message.

@param data: a string of indeterminate length. Please keep in mind

that you will probably need to buffer some data, as partial (or multiple) protocol messages may be received! I recommend that unit tests for protocols call through to this method with differing chunk sizes, down to one byte at a time.

log[source]