21 lines
405 B
Python
21 lines
405 B
Python
|
|
from flask import Flask, render_template
|
||
|
|
from flask_socketio import SocketIO, send
|
||
|
|
import sqlite3
|
||
|
|
|
||
|
|
app = Flask(__name__)
|
||
|
|
socketio = SocketIO(app)
|
||
|
|
|
||
|
|
|
||
|
|
@socketio.on('message')
|
||
|
|
def onMessage(msg):
|
||
|
|
send(msg, broadcast=True)
|
||
|
|
|
||
|
|
|
||
|
|
@app.route('/')
|
||
|
|
def routeLogin():
|
||
|
|
return render_template("chat.html")
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == '__main__':
|
||
|
|
socketio.run(app, host='0.0.0.0', debug=True, allow_unsafe_werkzeug=True)
|