python multiprocessing websocket server
Project description
parallel_websocket_server
run websocket server in parallel (using multiprocessing)
Installation
pip install parallel_websocket_server
How to use
import json
import random
from parallel_websocket_server import ParallelWebSocketServer
if __name__ == "__main__":
receive_queue = mp.Queue()
send_queue = mp.Queue()
server = ParallelWebSocketServer(receive_queue, send_queue)
while True:
if not receive_queue.empty():
received_message = receive_queue.get_nowait()
print(received_message)
ran = random.random()
if ran < 0.00001:
send_queue.put(json.dumps({"hoge": 1}))
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file parallel_websocket_server-0.1.0.tar.gz
.
File metadata
- Download URL: parallel_websocket_server-0.1.0.tar.gz
- Upload date:
- Size: 1.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.8.13 Darwin/22.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0c140aea1f573e82f65bd9d97c6e1d3c7706c596a4af86b080760abd6fc151f |
|
MD5 | a49aff80e373536aa084210d169e2b11 |
|
BLAKE2b-256 | badd3defb9cb85f925a0c05a5a9110351b20d5cfd23f27cc868cef6ee87bab44 |
File details
Details for the file parallel_websocket_server-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: parallel_websocket_server-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.8.13 Darwin/22.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 383a9fd4226fcc7a7d5d2af8bc5b1b47f37e848f0aa3c06e39a5ba363ff5c9fd |
|
MD5 | 246fd0424227fb87eccd6f70a195fb7e |
|
BLAKE2b-256 | 8a493932622a1b4287cf9c9376feedf4cef8a2589b1417e6607edd41b425b67e |