aiocoap.messagemanager module

This module contains all internals needed to manage messages on unreliable transports, ie. everything that deals in message types or Message IDs.

Currently, it also provides the mechanisms for managing tokens, but those will be split into dedicated classes.

class aiocoap.messagemanager.MessageManager(token_manager)

Bases: TokenInterface, MessageManager

This MessageManager Drives a message interface following the rules of RFC7252 CoAP over UDP.

It takes care of picking message IDs (mid) for outgoing messages, retransmitting CON messages, and to react appropriately to incoming messages’ type, sending ACKs either immediately or later.

It creates piggy-backed responses by keeping an eye on the tokens the messages are sent with, but otherwise ignores the tokens. (It inspects tokens only where required by its sub-layer).

property client_credentials

A CredentialsMap that transports should consult when trying to establish a security context

async shutdown()
dispatch_message(message)

Feed a message through the message-id, message-type and message-code sublayers of CoAP

dispatch_error(error, remote)

Callback to be invoked when the operating system indicated an error condition from a particular remote.

async fill_or_recognize_remote(message)

Return True if the message is recognized to already have a .remote managedy by this TokenInterface, or return True and set a .remote on message if it should (by its unresolved remote or Uri-* options) be routed through this TokenInterface, or return False otherwise.

send_message(message, messageerror_monitor)

Encode and send message. This takes care of retransmissions (if CON), message IDs and rate limiting, but does not hook any events to responses. (Use the Request class or responding resources instead; those are the typical callers of this function.)

If notification about the progress of the exchange is required, an ExchangeMonitor can be passed in, which will receive the appropriate callbacks.