{"id":18074239,"url":"https://github.com/binarskugga/webmesh","last_synced_at":"2025-06-27T13:39:48.826Z","repository":{"id":48402527,"uuid":"388605410","full_name":"BinarSkugga/webmesh","owner":"BinarSkugga","description":"Connects microservices through a mesh of websockets","archived":false,"fork":false,"pushed_at":"2022-01-29T11:57:41.000Z","size":86,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T05:52:15.794Z","etag":null,"topics":["mesh","mesh-network","microservice","msgpack","parallelism","python","python3","websocket","websocket-library","websocket-server","websockets","zlib"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BinarSkugga.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-22T21:47:37.000Z","updated_at":"2023-07-19T16:42:23.000Z","dependencies_parsed_at":"2022-09-21T20:13:01.679Z","dependency_job_id":null,"html_url":"https://github.com/BinarSkugga/webmesh","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinarSkugga%2Fwebmesh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinarSkugga%2Fwebmesh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinarSkugga%2Fwebmesh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinarSkugga%2Fwebmesh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BinarSkugga","download_url":"https://codeload.github.com/BinarSkugga/webmesh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525156,"owners_count":21118616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mesh","mesh-network","microservice","msgpack","parallelism","python","python3","websocket","websocket-library","websocket-server","websockets","zlib"],"created_at":"2024-10-31T10:11:49.905Z","updated_at":"2025-04-12T05:52:27.641Z","avatar_url":"https://github.com/BinarSkugga.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WebMesh\n![Deploy](https://github.com/binarskugga/webmesh/actions/workflows/python-publish.yml/badge.svg)\n\nWebMesh is a WebSocket based communication library for microservices. It uses a WebSocket server based on [wsproto](https://github.com/python-hyper/wsproto) that distributes clients on a thread pool to achieve high parallelism and performance. It aims at providing the building blocks to inter-connect multiple services at the application level seamlessly. (corporate lorem ipsum ends here).\n\n## Design\n\n[TODO]\n\n## Todo before first release\n- [ ] Add SSL Support\n- [ ] Improve Failure Resilience (retrying connections etc..)\n- [ ] Path arguments and resolution for consumers\n- [ ] Implement a Subscription System\n- [ ] Node discovery and status reporting\n  - [ ] Testaments \u0026 Last Will maybe ?\n- [ ] Implement a class that regroups a server and multiple clients to each peers (WebMesh(server, *peers) ?)\n\n## Tests \u0026 Lint\nInstall nox: `pip install nox`\n\nExecute all the session at the root of the project: `nox`\n\n## Install\n\nSimply execute: `pip install webmesh`\n\n\n## WebMesh Server\nWebMesh's server works like a standard HTTP server. It uses a declarative syntax with decorators defining callbacks on routes. Here's the basic example for a locally accessible echo server:\n\n```python\nfrom typing import Any\n\nfrom webmesh.websocket.abstract_websocket_connection import AbstractWebSocketConnection\nfrom webmesh.webmesh_server import WebMeshServer\n\nserver = WebMeshServer()\n\n\n@server.on('/')\ndef echo(payload: Any, path: str, client: AbstractWebSocketConnection):\n  return payload\n\n\nserver.listen()\nserver.await_started()\n\n# Server is ready and running in its own thread\n\nserver.close()\n```\n\nThis is all good and pretty but by default, WebMesh uses [msgpack](https://github.com/msgpack/msgpack-python) and zlib to communicate which makes it hard to manually use. You can change the serialization layer by providing an implementation of the `AbstractMessageSerializer` class. WebMesh provides a simple JSON serializer that you can pass into your server's constructor:\n\n```python\nfrom webmesh.webmesh_server import WebMeshServer\nfrom webmesh.message_serializers import StandardJsonSerializer\n\nserver = WebMeshServer(serializer_type=StandardJsonSerializer)\n```\n\n*Note: We are using the class and not an instance. This is because the websocket backend uses processes for parallelism. This limits us as to what we can use because it requires to be pickled. By passing the class, we can instantiate the serializer inside the process and have more flexibility.*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinarskugga%2Fwebmesh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinarskugga%2Fwebmesh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinarskugga%2Fwebmesh/lists"}