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
Metadata
Release files for meshsocket 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| meshsocket-0.2.0.tar.gz | 18.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| meshsocket-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.1 kB
Release files / meshsocket-0.2.0.tar.gz
| Download URL | meshsocket-0.2.0.tar.gz |
|---|---|
| Size | 18.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6b9ecfcc03ea1c40c4d5755cb375ad2743d3c3efa0addb80308fee21bd888422
|
|
BLAKE2b-256 checksum How to use checksums |
5fcc4034da78bbd186db85ec4149933f1b92336b2ee094f757beb654a6c494f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency logRelease files / meshsocket-0.2.0-py3-none-any.whl
| Download URL | meshsocket-0.2.0-py3-none-any.whl |
|---|---|
| Size | 20.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6722c12834e555da597cd101619503af70cf449033b0bda4fc4bb59fab5cb532
|
|
BLAKE2b-256 checksum How to use checksums |
675f5ef5c2c94d4a2bf1c1819af6aff534db10d8fedd7eb44f3c2969725750ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency log