Async Python IPC using WebSockets
Project description
wsipc
Async Python IPC using WebSockets
Server Example (Simple Broker)
from asyncio import run
from wsipc import WSIPCServer
server = WSIPCServer(heartbeat=45)
run(server.start(block=True))
Client Example
from asyncio import create_task, run, sleep
from wsipc import WSIPCClient
client = WSIPCClient()
@client.listener()
async def on_message(message):
print(message)
@client.listener()
def sync_listener(message):
print(message)
async def main() -> None:
create_task(client.connect())
await client.connected.wait()
await client.send("Hello World!")
await sleep(1)
await client.close()
run(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wsipc-0.0.3.tar.gz
(5.8 kB
view details)
Built Distribution
wsipc-0.0.3-py3-none-any.whl
(6.9 kB
view details)
File details
Details for the file wsipc-0.0.3.tar.gz
.
File metadata
- Download URL: wsipc-0.0.3.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.10.2 Linux/5.16.0-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14c105fbba37272b64753e968718e9550249e8e146d6dd3dafc2eebfa83339d1 |
|
MD5 | bc0d321489cf04339777485635d6231a |
|
BLAKE2b-256 | 2b23fcb7cb854aab7b3ecf22303b16618ee0f05e496aeeca8b31f93ccfd887d7 |
File details
Details for the file wsipc-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: wsipc-0.0.3-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.10.2 Linux/5.16.0-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d86f0dc42a1daac836baf7bfa30384e765be4e81b2895b3b188d44b3c9dd1a0 |
|
MD5 | c41db257565762557d83a0625e98fd1d |
|
BLAKE2b-256 | 73e9e3d7494b3bd5413321cc354d7625b02eee0c356b2cef9ea18e13e563541d |