General
There are multiple ways to start serving one's Thing instance based on the application requirements:
- One needs to run one
Thinginstance in one or multiple protocols - One needs to run multiple
Thinginstances in one protocol - One needs to run multiple
Things instances in multiple protocols
Run Single Thing in Multiple Protocols
To configure a protocol server in a detailed fashion, instantiate them explicitly.
To start serving, one can pass them as an argument to the run() method of the Thing:
Based on the protocol, the servers may support overriding the exposed configuration, for example, changing the HTTP URL path, or overriding an MQTT publishing worker.
The number of such features supported is generally a work in progress. Please consider reading the codebase if you wish to implement a highly specific feature, and also consider contributing your feature to the repository - How to Contribute.
Alternatively, to quickly expose the Thing instance, supply the protocol name and the access point (port or address) as a tuple to the run() method.
| Quick Start | |
|---|---|
HTTP and ZMQ support a run_with_<protocol> method:
| Quick Start Option 2 | |
|---|---|
Run Multiple Things in One Protocol
All protocols support an add_thing() method that accepts a Thing instance
and a run() and stop() method that control their boot up & shutdown:
| add Things to protocol server | |
|---|---|
Run Multiple Things in Multiple Protocols
Use the global run() method along with server.add_thing() to start any number of Thing instances in any number of protocols: