Language
简体中文English
FloraServer
By inheriting a large number of modified websocket-server library classes to customize a network router, splitting regular HTTP connections from WebSocket connections, and constructing a WSGI environment and HTTP request headers to call flask, websocket-server and flask can communicate on the same port
How to use it?
You can choose to directly 'clone' this repository into your project- Use the following command to install
pip install FloraServer
- Import
FloraServerinto your projectFrom FloraServer import [class]There are twoWebSocketServer classesin this project, one isFloraFlaskWSServer, the protagonist of this repository, and the other isFloraWebsocket Server, which is not much different fromWebsocket Server, only with relatively loose connections - To start using, follow the development documentation for
flaskandwebsocket-server
Code Demonstration
from FloraServer import FloraFlaskWSServer
from flask import Flask
app = Flask(__name__)
@app.route("/")
def index():
return "Hello world!"
def on_message(client, server, message):
print(message)
if __name__ == "__main__":
server = FloraFlaskWSServer(flask_app=app, host="0.0.0.0", port=5000)
server.set_fn_message_received(on_message)
server.run_forever()
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
floraserver-0.1.0.tar.gz
(4.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file floraserver-0.1.0.tar.gz.
File metadata
- Download URL: floraserver-0.1.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
pdm/2.22.3 CPython/3.13.1 Linux/6.8.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0347cf35f7fd8e2cfb138f92d90c6ecd66387c93c4ff46534497db4c60d9fac
|
|
| MD5 |
3b2ae3b834d97876d5ca1c1f4b8f7efd
|
|
| BLAKE2b-256 |
dac39e49aad812724e3ca78a181e5b40a392fa3c2e0a2684938d8dea5ae90462
|
File details
Details for the file floraserver-0.1.0-py3-none-any.whl.
File metadata
- Download URL: floraserver-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
pdm/2.22.3 CPython/3.13.1 Linux/6.8.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc86938c62a3fa685606cefd45a9d3092f66e75ecceb6990c62f403bf076358a
|
|
| MD5 |
7ef3edf580beaaaabfb81f846b53d29a
|
|
| BLAKE2b-256 |
fcace0126d0e24381ef657e9f923e638e964b3444b49b1f60034a5d5a55d4bef
|