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.1.tar.gz
(5.4 kB
view details)
Built Distribution
wsipc-0.0.1-py3-none-any.whl
(6.6 kB
view details)
File details
Details for the file wsipc-0.0.1.tar.gz
.
File metadata
- Download URL: wsipc-0.0.1.tar.gz
- Upload date:
- Size: 5.4 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 | e8ba34b1ae6d087e6013b63eac8b9cfbd578c5206563a0f223ceece4cd8d307a |
|
MD5 | 350b0fc05c0b7a613d53629efce683b7 |
|
BLAKE2b-256 | 4e8e4b29e9a4fb671c456d99a96d9a58bdc423ef9497cbdbb17c7b5c58264174 |
File details
Details for the file wsipc-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: wsipc-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.6 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 | 62e4a841217f2f59a24d7b87e11d6cc6843cfa44d2999c328380d9af6103a3fe |
|
MD5 | 0417e6e38c67daa1e8aa89b2df56c263 |
|
BLAKE2b-256 | fb229a7d41d13d0b52b0c71b04fa4b4deb55af7c5f8b5dd52df3fbf47103363b |