Skip to main content

parallel_websocket_server

run websocket server in parallel (using multiprocessing)

You can run the websocket server as a subprocess while keeping the main process distinct.

You can implement the main process without having to pay attention to the server.

Installation

pip install parallel_websocket_server

How to use

import json
import random
import multiprocessing as mp
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}))

Metadata

Release files for parallel_websocket_server 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for parallel_websocket_server 0.1.3
File Size Uploaded
parallel_websocket_server-0.1.3.tar.gz 1.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for parallel_websocket_server 0.1.3
File Interpreter ABI Platform
parallel_websocket_server-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 4.2 kB

Release files / parallel_websocket_server-0.1.3.tar.gz

Download URL parallel_websocket_server-0.1.3.tar.gz
Size 1.8 kB
Tags Source
SHA-256 checksum
How to use checksums
31deedb89f1b625d24f6f8217758a610a24b97c81a5e32be85befe79f3c9d492
BLAKE2b-256 checksum
How to use checksums
c1b16ecb9f38d6c62a0fb74ab0de8405cdb63ecb274fa56b053824d45c32eea2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.5 Linux/6.2.0-1012-azure

Release files / parallel_websocket_server-0.1.3-py3-none-any.whl

Download URL parallel_websocket_server-0.1.3-py3-none-any.whl
Size 2.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9be892bf5f8235de189436d917cf1d288ff7fb5aab7241539f9269e7a29e2b5
BLAKE2b-256 checksum
How to use checksums
ed2f23de26718ad3bca1e62c047bd8c76960f9a59c40199dceeee81d10e2f4d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.5 Linux/6.2.0-1012-azure

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page