EchoRPC
Bidirectional JSON-RPC 2.0 over WebSocket for Python.
Install
pip install echorpc
Quick Start
Server
from echorpc import EchoServer
server = EchoServer(port=9100, auth_handler=lambda p: p["token"] == "secret")
# Define a command that clients can call
@server.command("add")
def add(params):
return {"sum": params["a"] + params["b"]}
# Listen for events from clients
@server.event("chat")
async def on_chat(data):
print("on_chat", data)
await server.start()
Client
from echorpc import EchoClient
client = EchoClient("ws://localhost:9100", token="secret")
# Let the server call you back
client.register("double", lambda p: p["x"] * 2)
# Subscribe to events
client.subscribe("chat", lambda data: print(data))
await client.connect()
# Call a server command
result = await client.request("add", {"a": 1, "b": 2})
# Publish event to the server
await client.publish("chat", {"text": "hello"})
# Send multiple calls at once
results = await client.batch_request([
("add", {"a": 1, "b": 2}),
("add", {"a": 3, "b": 4}),
])
Error Codes
| Code | Name | Meaning |
|---|---|---|
| -32700 | Parse error | Invalid JSON |
| -32601 | Method not found | No such method |
| -32603 | Internal error | Handler threw |
| -32001 | Not connected | No active connection |
| -32002 | Timeout | Request timed out |
| -32003 | Auth failed | Authentication rejected |
License
MIT License © 2026-PRESENT Del Wang
Metadata
Release files for echorpc 1.0.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 | Provenance | Actions |
|---|---|---|---|---|
| echorpc-1.0.0.tar.gz | 11.5 kB | Without provenance | Details for echorpc-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| echorpc-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for echorpc-1.0.0-py3-none-any.whl |
Total release size: 29.2 kB
Release files / echorpc-1.0.0.tar.gz
| Download URL | echorpc-1.0.0.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc82970be25848d2bdc75fc5606c369b643a4186365c56f04fb93d772bfb4e41
|
|
BLAKE2b-256 checksum How to use checksums |
296fab37fb406aa8902b1a41354b683b88b15fc811e7869168f0b40a604d5a92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.2
|
Release files / echorpc-1.0.0-py3-none-any.whl
| Download URL | echorpc-1.0.0-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2a5d71b11fd22958c131e1ccd56d653c198b04fbd95f234688baec3a6f2b1de3
|
|
BLAKE2b-256 checksum How to use checksums |
af93ff090a44e6627b1cd6337845753202ec0065dc018d4a45953b85d6aff8fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.2
|
Security for echorpc 1.0.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.