Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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()

Add workers:

Handler1(Worker1(), Worker2())

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.

Files for message-listener, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size message_listener-1.1.0-py3-none-any.whl (5.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size message_listener-1.1.0.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page