I have this script:
from flask import Flask
from flask_socketio import SocketIO, send
app = Flask(__name__)
socketio = SocketIO(app)
def run_server():
socketio.run(app)
@socketio.on('message')
def handleMessage(msg):
print('Message: ' + msg)
send(msg)
if __name__ == '__main__':
socketio.start_background_task(run_server)
Every time i'm running that script the program begin and finish immediately.
I want to have both a Web server and a SocketIO server at the same app.
Maybe by having a port that listens to simple HTTP requests and a port that listens for SocketIO requests.