Skip to main content

Server listener and iot_message handler

Project description

App used at Raspberry Pi as receiver of incoming messages and pass them to registered handlers (relay, screen, sensors)

from message_listener.server import Server
from iot_message.message import Message
from message_listener.handler_debug import HandlerDebug
from iot_message.cryptor.base64 import Cryptor as B64

Message.node_name = "PC"
Message.add_decoder(B64())
#Message.drop_unencrypted = True

svr = Server()
# svr.ignore_missing_decoders = False
svr.add_handler('NodeOne', HandlerDebug({}))
svr.start()

Add more than one handler:

svr = Server()
svr.add_handler('NodeOne', HandlerDebug({}))
svr.add_handler('NodeOne', HandlerDebug({}))
svr.start()

or

svr = Server()
svr.add_handler('NodeOne', [
    HandlerDebug({}),
    HandlerDebug({})
])
svr.start()

Initialization:

__init__(self, port=5053, ip_address='0.0.0.0', buffer_size=65535)

Read more:

[https://koscis.wordpress.com/2017/03/03/raspberry-pi-as-a-node/](https://koscis.wordpress.com/2017/03/03/raspberry-pi-as-a-node/)

[https://koscis.wordpress.com/2019/08/31/upgrades-to-message_listener/](https://koscis.wordpress.com/2019/08/31/upgrades-to-message_listener/)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

message_listener-1.0.1.linux-armv6l.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

message_listener-1.0.1-py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page