├── README.md ├── main.py └── templates └── index.html /README.md: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | to install socketio: `pip3 install flask-socketio` 3 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template 2 | from flask_socketio import SocketIO, send 3 | 4 | app = Flask(__name__) 5 | app.config['SECRET_KEY'] = 'secret!' 6 | socketio = SocketIO(app) 7 | 8 | @app.route('/') 9 | def index(): 10 | return render_template('index.html') 11 | 12 | @socketio.on('message') 13 | def handleMessage(msg): 14 | print('Message: ' + msg) 15 | send(msg, broadcast = True) 16 | 17 | if __name__ == '__main__': 18 | socketio.run(app) 19 | -------------------------------------------------------------------------------- /templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 17 | 18 | 33 | 34 | 35 | --------------------------------------------------------------------------------