Skip to main content

MeshSocket (Python)

PyPI Downloads Python versions

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.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for meshsocket 0.4.3
File Size Uploaded Provenance Actions
meshsocket-0.4.3.tar.gz 20.1 kB With provenance Details for meshsocket-0.4.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for meshsocket 0.4.3
File Interpreter ABI Platform Actions
meshsocket-0.4.3-py3-none-any.whl Python 3 none any Details for meshsocket-0.4.3-py3-none-any.whl

Total release size: 41.7 kB

Release files / meshsocket-0.4.3.tar.gz

Download URL meshsocket-0.4.3.tar.gz
Size 20.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f07dae026747221a8de642332aff35da1cb6db95e7b5d3ffc2d2d4bbcb865419
BLAKE2b-256 checksum
How to use checksums
293688b17db58d733cac05ca987d887aabe3a8780569376c83c132310008ef6b
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 Nov 12, 2026.

Transparency log

Release files / meshsocket-0.4.3-py3-none-any.whl

Download URL meshsocket-0.4.3-py3-none-any.whl
Size 21.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ad89471439a8daf92bcedd981930992c1e70889149d852016960c152c57832f
BLAKE2b-256 checksum
How to use checksums
42c19f13deb8bd2c5d26d0bcb64fcc72cd79404bcca1f411c062ef0a010a8300
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 Nov 12, 2026.

Transparency log

Security for meshsocket 0.4.3

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for meshsocket-0.4.3.tar.gz

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 Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page