A client library designed for connecting to a iot.io server instance.
Project description
iot.io Client
iot.io Overview
This project aims to create a lightweight and intuitive system for connecting IoT devices to a central server for small IoT system implementations and hobbyists.
The framework focuses on providing easy to use system of libraries so the end user does not need to understand the protocol implementation, though this also is fairly simple.
The format of the framework is somewhat reminiscent of Socket.IO where handlers functions are defined and executed and run as events are triggered.
Quickstart Guide (Client)
This is an example of a simple IoTClient instance which connects to a server accepting "echo" clients ping the server every 5 seconds with a message and print the server's response.
from iotio_client import IoTClient
import threading
import time
# create client
client = IoTClient("echo_test_client", "echo")
# define a handler for "echo_response" events
@client.on("echo_response")
def echo(data):
print("'echo_response' from Server: '" + str(data) + "'\n")
def send():
client.ensure_open()
# loop while client is connected
while client.connected:
message = input("Enter a value to send to the server: ")
# send message over the echo channel
client.send("echo", message)
print("")
time.sleep(1)
# start background send task
send_thread = threading.Thread(None, send)
send_thread.start()
# connect client
client.run("localhost:5000", use_tls=False)
send_thread.join()
If you would like to see the matching quick-start guide for an example server go here.
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
Built Distributions
Hashes for iot.io_client-0.4.12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3716f1b86055f06cf439a08dd3ef778632716974601c79084c838dc375072030 |
|
MD5 | cb1acc0a58420ed8f57357e3e07706ec |
|
BLAKE2b-256 | 74cfa017ee26fad9648e8269b96c1bdbb8cb33fd39c7540d8eddfbd9c50c28d0 |