A simple, natively parallel WebSocket server module for Python built with Rust, tokio, and pyo3.
Project description
quicksocket
A simple WebSocket server built in Rust using tokio, tokio-tungstenite, and pyo3. Supports Windows, macOS, and Linux. Still unstable!
pip install quicksocket
Check out example-usage/quicksocket_with_types.py for an example of a wrapper WebsocketServer class around the quicksocket API and also provides type annotations for e.g. autocompletion in your IDE.
Not stable, a bit verbose, and a bit messy!
The server listens for WebSocket connections on port 50808
, and currently this is not configurable. (see src/server/tokio_server.rs).
quicksocket's code is originally designed for use with Ultraleap's Web Visualizer project, and as such is intended for a console python visualizer server and leverages plain println!
s for logging purposes.
At some point in the future it'll make sense to switch to some proper env logging system. Pardon the mess :)
Building Locally
You'll need Rust and access to some python.exe of version 3.6 or greater.
You'll also need OpenSSL. See the Ubuntu section for installation details on Ubuntu. OpenSSL is slightly trickier for Windows. You can use Chocolatey or vcpkg, or download a binary distribution of OpenSSL. You may need to set $Env:OPENSSL_DIR
(PowerShell syntax) to your installation directory for your Windows build session if using Chocolatey, or a binary install, or if vcpkg isn't activated for your session. macOS should have it by default.
Once Rust is installed:
cargo build --release
This will output an .so or a .pyd depending on your OS into the target/release
directory.
To build a wheel for your python/OS combo:
pip install maturin
maturin build
There's CI for Windows, macOS, and Linux for Pythons 3.6 through 3.9. Check out the Actions tab for now (proper release tags coming "soon").
Targeting builds to specific Python versions
If you're targeting a specific python version, or if you don't have python on your PATH, you can set PYTHON_SYS_EXECUTABLE
to the python executable in your machine with that version.
e.g., on Windows via Git Bash:
PYTHON_SYS_EXECUTABLE=/c/my/path/to/python.exe cargo build --release
Ubuntu
Make sure you have libssl and libpython installed:
sudo apt-get install libssl-dev
sudo apt-get install libpython3-dev
If you encounter errors building pyo3
, you may need to check whether it can find your python and any related python dev dependencies: https://pyo3.rs/v0.10.1/building_and_distribution.html
Todos:
Little utility HTML via github pages
Could expose this through Github Pages so it's easy for a new user to test their server usage: https://github.com/nickjbenson/quicksocket/blob/main/archive/examples/wip01_basic_websocket_client.html
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file quicksocket-1.0.0-cp39-none-win_amd64.whl
.
File metadata
- Download URL: quicksocket-1.0.0-cp39-none-win_amd64.whl
- Upload date:
- Size: 417.0 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f5818f0d9901311c203caf90a8975e43c8578bd05c1090ddfc6cf7e3783c5e0 |
|
MD5 | c30c69095e45abd09a0cbead817f057f |
|
BLAKE2b-256 | 17d555ccabc9f7e22b51abc19f5e41c8d02a6efcf4247e8297aacc4200afc915 |
File details
Details for the file quicksocket-1.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: quicksocket-1.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb9428847586e6d046d34ae53df9deb80436004ee7768482884d17f7906a6a52 |
|
MD5 | 0a5dd2170b86440c4168ecbb9dc81ba5 |
|
BLAKE2b-256 | 7aa16634f491ae5061777cf86f81474fc8afde961c00808c364aa36a90bd0d78 |
File details
Details for the file quicksocket-1.0.0-cp39-cp39-macosx_10_7_x86_64.whl
.
File metadata
- Download URL: quicksocket-1.0.0-cp39-cp39-macosx_10_7_x86_64.whl
- Upload date:
- Size: 559.1 kB
- Tags: CPython 3.9, macOS 10.7+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d093e32b98a94b1b1d4db66bfb558d4aebf5bd2a501b03b6aab4d8a4dbef5ac |
|
MD5 | e9904fc7e52d5e36f156e87533940e53 |
|
BLAKE2b-256 | 8e55f06587102d43fe9a4d063ec977af746937dacd628c2d8562b2cb551ebe34 |
File details
Details for the file quicksocket-1.0.0-cp38-none-win_amd64.whl
.
File metadata
- Download URL: quicksocket-1.0.0-cp38-none-win_amd64.whl
- Upload date:
- Size: 416.6 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e5b92291bd8f14e386058f94704ef8be6d0b27dbb86b8e585183b64228ad3ce |
|
MD5 | cfb0c32fc9cb21545a33f4d48fcda932 |
|
BLAKE2b-256 | fe3592a34337c31c3d6c67219d15b03cbfefd1cd1630ae4577b3b0a70ebca799 |
File details
Details for the file quicksocket-1.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: quicksocket-1.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88589e445da5f76274dc65d15bb1ab9db7f5ea7fcf8715d4e5eab1d687ddd454 |
|
MD5 | 86eecae28b625f70411ac518b037844e |
|
BLAKE2b-256 | 80dd79b2424b6bf3519362e69d69a3ebf824ca73c6c9df5d8337abf2eae1ca55 |
File details
Details for the file quicksocket-1.0.0-cp38-cp38-macosx_10_7_x86_64.whl
.
File metadata
- Download URL: quicksocket-1.0.0-cp38-cp38-macosx_10_7_x86_64.whl
- Upload date:
- Size: 559.2 kB
- Tags: CPython 3.8, macOS 10.7+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d48f56fb4f206e68585576d02b19f0ca210dc32d79b80a62d3af8639993fff06 |
|
MD5 | adada15a2e4872762bb5ef2ed3348c68 |
|
BLAKE2b-256 | 8ff9f3aa7891429a6ac2b65138caa9753f443a63299c56d67d87e5006e758da4 |
File details
Details for the file quicksocket-1.0.0-cp37-none-win_amd64.whl
.
File metadata
- Download URL: quicksocket-1.0.0-cp37-none-win_amd64.whl
- Upload date:
- Size: 416.7 kB
- Tags: CPython 3.7, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10f02109f733ff530f5c258aecf595676c50aadc96112d82dcf4e3766e4d65a2 |
|
MD5 | a15821d9f5ee7c6c2a7ec3e522133020 |
|
BLAKE2b-256 | cd7d31f8e364c30e1da5e91d633d524196b3894a1b83b1951931d6c8eca7048a |
File details
Details for the file quicksocket-1.0.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: quicksocket-1.0.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb720328fbf96492840c695596fc53f2179ee71ddf44704543504135da855301 |
|
MD5 | 29bd07da04158e07c3371b6b0c9a3147 |
|
BLAKE2b-256 | fa31e123d5f4f3a156f5c379043f0925e492a76da33839fb682901483a27dd05 |
File details
Details for the file quicksocket-1.0.0-cp37-cp37m-macosx_10_7_x86_64.whl
.
File metadata
- Download URL: quicksocket-1.0.0-cp37-cp37m-macosx_10_7_x86_64.whl
- Upload date:
- Size: 559.7 kB
- Tags: CPython 3.7m, macOS 10.7+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ab825cdf5c301020ae3d8dc6fd2f4dd20cbe9b7ccfe31184ad6455be6469210 |
|
MD5 | 7a9181ba94ea4c9d4fab3f11b6115637 |
|
BLAKE2b-256 | f5b5411ccaba50a3403ab833d6ef9b73621875a31136bbab6a5594abfe3135b1 |
File details
Details for the file quicksocket-1.0.0-cp36-none-win_amd64.whl
.
File metadata
- Download URL: quicksocket-1.0.0-cp36-none-win_amd64.whl
- Upload date:
- Size: 416.3 kB
- Tags: CPython 3.6, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e44f7333ace97d5aad21931f078aa0c81f4f9742539a0214976dde768f97a9f |
|
MD5 | fd32e461a85e475b0ab808f67abe01d7 |
|
BLAKE2b-256 | e287561fcb0f0849a1dea62e529c231fccf22a9c342d728904bb59ae8b7be5c7 |
File details
Details for the file quicksocket-1.0.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: quicksocket-1.0.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.6m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a05a9695aa1e6e35b5fac49038d412b9a9dd0029c3404a918fd7f18ec34872ce |
|
MD5 | 033ca118c4f88228f0ecddd9b7e08a88 |
|
BLAKE2b-256 | 99ddfdeae079b1f404dbfeaa99aed540f370e24b2384fb9eb05c3bc838971e03 |
File details
Details for the file quicksocket-1.0.0-cp36-cp36m-macosx_10_7_x86_64.whl
.
File metadata
- Download URL: quicksocket-1.0.0-cp36-cp36m-macosx_10_7_x86_64.whl
- Upload date:
- Size: 558.2 kB
- Tags: CPython 3.6m, macOS 10.7+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95d3b4974987aa76b9d3f964ae26f09eaa91b3ccf82865cbd5e7260abc659a9e |
|
MD5 | 55e2b7e6b57894fc4a248072c4bafadf |
|
BLAKE2b-256 | 9798e3fe84cc11c427100eac58d5b4a7caed59c9b36be60d256a9cad83d698d4 |