-
Notifications
You must be signed in to change notification settings - Fork 40
Socketio
Beau Barker edited this page Jul 3, 2025
·
4 revisions
"""SocketIO server""" from flask import Flask, Request from flask_socketio import SocketIO, send # type: ignore
from jsonrpcserver import Result, Success, dispatch, method
app = Flask(name) socketio = SocketIO(app)
@method def ping() -> Result: """JSON-RPC method""" return Success("pong")
@socketio.on("message") # type: ignore def handle_message(request: Request) -> None: """Handle SocketIO request""" if response := dispatch(request): send(response, json=True)
if name == "main": socketio.run(app, port=5000)
Contributions are appreciated – simply hit Edit or New page.