valde/app.py

35 lines
635 B
Python
Raw Normal View History

2024-01-25 23:08:03 +00:00
from flask import Flask, render_template
from flask_socketio import SocketIO, emit
app = Flask(__name__)
socketio = SocketIO(app)
# Normal app routes
@app.route('/')
def index():
return render_template('index.html')
@app.route('/spe')
def spe():
return render_template('spe.html')
# Socket IO stuff
@socketio.on('action')
2024-01-27 04:58:07 +00:00
def action():
2024-01-25 23:08:03 +00:00
socketio.emit('all_action')
2024-01-27 04:58:07 +00:00
@socketio.on('noise')
def noise():
socketio.emit('all_noise')
@socketio.on('stop')
def stop():
socketio.emit('all_stop')
2024-01-25 23:08:03 +00:00
if __name__ == '__main__':
socketio.run(
app,
host='0.0.0.0',
allow_unsafe_werkzeug=True
)