coapthon.server package

Submodules

coapthon.server.coap module

class coapthon.server.coap.CoAP(server_address, multicast=False, starting_mid=None, sock=None, cb_ignore_listen_exception=None)[source]

Bases: object

Implementation of the CoAP server

add_resource(path, resource)[source]

Helper function to add resources to the resource directory during server initialization.

Parameters:
  • path – the path for the new created resource
  • resource (Resource) – the resource to be added
close()[source]

Stop the server.

listen(timeout=10)[source]

Listen for incoming messages. Timeout is used to check if the server must be switched off.

Parameters:timeout – Socket Timeout in seconds
notify(resource)[source]

Notifies the observers of a certain resource.

Parameters:resource – the resource
purge()[source]

Clean old transactions

receive_request(transaction)[source]

Handle requests coming from the udp socket.

Parameters:transaction – the transaction created to manage the request
remove_resource(path)[source]

Helper function to remove resources.

Parameters:path – the path for the unwanted resource

:rtype : the removed object

send_datagram(message)[source]

Send a message through the udp socket.

Parameters:message (Message) – the message to send

Module contents