rpikvm/socketiotest.py
2020-06-05 16:14:56 +02:00

20 lines
384 B
Python

from flask import Flask, render_template
from flask_socketio import SocketIO
app = Flask(__name__)
socketio = SocketIO(app)
@app.route("/")
def index():
return render_template("socketio.html")
@socketio.on('my event')
def handle_my_custom_event(json):
print('received json: ' + str(json))
if __name__ == '__main__':
socketio.run(host="0.0.0.0", port=8001, app=app)