I am trying to set up a Flask server which can use SocketIO
, however it doesn't work and it returns me this following error:
ValueError: signal only works in main thread
This is my setup for the flask environment:
export FLASK_APP=application.py
export FLASK_DEBUG=1
Then I run like I would normally do, and would work before I started using SocketIO
:
flask run
Here is my code for application.py
, which is very simple but maybe it helps:
import os
from flask import Flask
from flask_socketio import SocketIO, emit
app = Flask(__name__)
app.config["SECRET_KEY"] = os.getenv("SECRET_KEY")
socketio = SocketIO(app)
@app.route("/")
def index():
return "Hello, world"