28 lines
521 B
Python
28 lines
521 B
Python
|
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')
|
||
|
def hey():
|
||
|
print('action')
|
||
|
socketio.emit('all_action')
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
socketio.run(
|
||
|
app,
|
||
|
host='0.0.0.0',
|
||
|
allow_unsafe_werkzeug=True
|
||
|
)
|