Lightweight WebSocket mesh networking — broadcast, direct routing, and request/response over a simple JSON wire protocol.
Project description
MeshSocket (Python)
A lightweight WebSocket mesh networking library. Nodes connect to a central relay and communicate by broadcast, direct routing, and request/response — all over a simple JSON wire protocol.
Install
pip install meshsocket
Quickstart (client)
import asyncio
from meshsocket import MeshSocket
async def main():
sock = MeshSocket(url="ws://localhost:8765", name="my-node",
channel="demo", role="device", can_broadcast=True)
async def on_toggle(payload):
print("got", payload)
return {"ok": True} # a returned value is delivered as the reply
sock.on("toggle", on_toggle)
await sock.start() # connect + identify
await sock.wait_until_ready()
await sock.send("reading", {"temp_c": 21.4}) # broadcast to the channel
await asyncio.sleep(60)
await sock.stop()
asyncio.run(main())
Wire protocol
Every message is a JSON object:
{ "id": "uuid", "type": "message_type", "payload": "<any JSON or null>", "reply_to": "uuid or null" }
If a handler returns a value, the receiver sends a reply with reply_to set to the
original id, enabling request/response round-trips.
Compatibility
from meshsocket import MeshSocket is the supported import. The historical
from socketCore import MeshSocket still works (that module is published alongside the
package) so existing code keeps running while it migrates.
Other language clients
Swift (SPM, zero-dependency) and a planned JavaScript client live in the same repo: https://github.com/Mariner10/MeshSocket
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file meshsocket-0.1.0.tar.gz.
File metadata
- Download URL: meshsocket-0.1.0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
705b352953dc33a304f02d0f3d954724bd57b4eec9ee6797f18ba3c4298d2dab
|
|
| MD5 |
0de1bfd13c61435d38319b3fad69e3e0
|
|
| BLAKE2b-256 |
2ab61359f5c202f7aacac96848d8cfab213978b02497efe2217873207d289f62
|
Provenance
The following attestation bundles were made for meshsocket-0.1.0.tar.gz:
Publisher:
publish.yml on Mariner10/MeshSocket
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
meshsocket-0.1.0.tar.gz -
Subject digest:
705b352953dc33a304f02d0f3d954724bd57b4eec9ee6797f18ba3c4298d2dab - Sigstore transparency entry: 1913685923
- Sigstore integration time:
-
Permalink:
Mariner10/MeshSocket@0838ec7c7ead7794c5b061b7166a853add46546e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Mariner10
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0838ec7c7ead7794c5b061b7166a853add46546e -
Trigger Event:
push
-
Statement type:
File details
Details for the file meshsocket-0.1.0-py3-none-any.whl.
File metadata
- Download URL: meshsocket-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d7a91ec51ec78378d7e1f4aba588567eac753f0769fa9e2c471a1d0280b43e1
|
|
| MD5 |
0ad5f7e9fa0e9e7f7e2227b0efa982f5
|
|
| BLAKE2b-256 |
9aa2bc6e7d1b6fa23f2848b849cbc0ce29c197ed9ebc5f26cebd48a3ceb9937a
|
Provenance
The following attestation bundles were made for meshsocket-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Mariner10/MeshSocket
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
meshsocket-0.1.0-py3-none-any.whl -
Subject digest:
6d7a91ec51ec78378d7e1f4aba588567eac753f0769fa9e2c471a1d0280b43e1 - Sigstore transparency entry: 1913686017
- Sigstore integration time:
-
Permalink:
Mariner10/MeshSocket@0838ec7c7ead7794c5b061b7166a853add46546e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Mariner10
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0838ec7c7ead7794c5b061b7166a853add46546e -
Trigger Event:
push
-
Statement type: