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

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.1
File Size Uploaded Provenance Actions
meshsocket-0.4.1.tar.gz 20.0 kB With provenance Details for meshsocket-0.4.1.tar.gz

Built distribution (wheel)

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

Total release size: 41.5 kB

Release files / meshsocket-0.4.1.tar.gz

Download URL meshsocket-0.4.1.tar.gz
Size 20.0 kB
Tags Source
SHA-256 checksum
How to use checksums
180466f5fe3baf3d159f738ed2b1f4d1058d25ef278a6bb9b45248d39bf2c5f6
BLAKE2b-256 checksum
How to use checksums
4e9468cf2a0f7a4b9b6ccd03dcb574bd75c0ca10b11e1ddc62ac0285a929be12
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 6, 2026.

Transparency log

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

Download URL meshsocket-0.4.1-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a8f084e3017e9dd2a9952a4f0107c50e0197946302672a700e6c8a22265e3ee
BLAKE2b-256 checksum
How to use checksums
4d5b5a895342b0db9da672e6566d8983dd73e074381449d6fc92968ee697d086
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 6, 2026.

Transparency log

Security for meshsocket 0.4.1

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.1.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 6, 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