Talk to a socketio server
Project description
Smartphone Connector
This simple package exposes methods to interact with smartphones connected to a socket.io server instance.
Socket Server
This package talks with a socket.io server, which defines the following interface:
Events
device
{ 'deviceId': str, 'isController': bool, 'deviceNr': int, 'socketId': str }
- `devices``
[ { 'deviceId': str, 'isController': bool, 'deviceNr': int, 'socketId': str }, ... ]
all_data
[ { 'deviceId': str, 'timeStamp': int, # time (ms) since client loaded page, ... }, ... ]
new_data
{ 'deviceId': str, 'timeStamp': int, # time (ms) since client loaded page, ... }
Actions (for emitting)
emit('clear_data', { 'deviceId': str })
emit('new_device', { 'deviceId': str })
emit('get_all_data', { 'deviceId': str })
emit('get_devices', { 'deviceId': str })
emit('new_data', { 'deviceId': str, timeStamp: int, ... })
emit('new_data', { 'deviceNr': int, timeStamp: int, ... })
A simple socket io server implementing this interface can be seen on github.com/lebalz/socketio_server. A running server is currently (August 2020) deployed under io.lebalz.ch.
Example
from smartphone_connecter
connector = Connector('https://io.lebalz.ch', 'FooBar')
# draw a 3x3 checker board
connector.set_grid([
['black','white','black'],
['white','black','white'],
['black','white','black']
], broadcast=True)
results on all devices in the following screen.
When broadcast
is set to False
(default), only the FooBar
devices display the checker board.
Package and upload to pip
@see this tutorial
python3 setup.py sdist bdist_wheel
python3 -m twine upload dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for smartphone-connector-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 373c40fabac3178ad21cf16f026a93b855b53174535dfdac40c05a5ddcd26bd0 |
|
MD5 | d56895597d8271329481d4d65520e3ba |
|
BLAKE2b-256 | 69d9c37bd21abec55de3908fcbf86e31d1608bded3d17ed10be36a3aa8392d0d |
Close
Hashes for smartphone_connector-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50675bac43e2f15b96a71bbc360baf4f5af404880671ee663b0e25f8a42b4ef7 |
|
MD5 | e6de872c21d337c2018da9be58197007 |
|
BLAKE2b-256 | bd13041247536eb1e79e061f29620cb1e0e3fbace4b403b623ab614d50d2615d |