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:
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.1.0.tar.gz
(3.8 kB
view hashes)
Built Distribution
Close
Hashes for message_listener-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8a723a5c59b45954b8d9ada738f55748cc5262dc17dd2cf52e6a52003784d1b |
|
MD5 | e4249aa9fddde5ad84771a45001d5dff |
|
BLAKE2b-256 | b281db45b86e3bbb8590c30e370475225a508065901ca3d7e363b0d5b905fedd |