crossbar.bridge.mqtt.tx

Attributes

Classes

MQTTServerTwistedProtocol

This is the base class for streaming connection-oriented protocols.

Message

Session

Module Contents

class MQTTServerTwistedProtocol(handler, reactor, _id_maker=_ids)[source]

Bases: twisted.internet.protocol.Protocol

This is the base class for streaming connection-oriented protocols.

If you are going to write a new connection-oriented protocol for Twisted, start here. Any protocol implementation, either client or server, should be a subclass of this class.

The API is quite simple. Implement L{dataReceived} to handle both event-based and synchronous input; output can be sent through the ‘transport’ attribute, which is to be an instance that implements L{twisted.internet.interfaces.ITransport}. Override C{connectionLost} to be notified when the connection ends.

Some subclasses exist already to help you write common types of protocols: see the L{twisted.protocols.basic} module for a few of them.

property _connected[source]
_connection_id[source]
_flush_publishes = None[source]
_flush_saved_messages()[source]
_handle(data)[source]
_handle_data(data)[source]
_handle_events(events)[source]
_handler[source]
_lose_connection()[source]
_mqtt[source]
_reactor[source]
_reset_timeout()[source]
_resume_producing()[source]
_send_packet(packet)[source]
_send_publish(topic, qos, body, retained)[source]
_timeout = None[source]
_timeout_time = 0[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]
send_publish(topic, qos, body, retained)[source]
send_suback(packet_identifier, return_codes)[source]
session[source]
class Message[source]

Bases: object

body[source]
qos[source]
retained[source]
topic[source]
class Session[source]

Bases: object

_count[source]
client_id[source]
get_packet_id()[source]
queued_messages[source]
_SIXTEEN_BIT_MAX = 65535[source]
_ids[source]