Questions tagged [flask-socketio]

Flask-SocketIO lets Flask python applications access low latency bi-directional communications between the clients and the server

Flask-SocketIO is an open source library which implements the abstraction, for delivering low latency client-server communication in a application developed by Miguel Grinberg.

1052 questions
7
votes
1 answer

WebSocket connection between reactjs Client and flask-socketio Server doesn't open

In my project I am using a React front-end and a Flask server with a RESTful API. The basic functionality is that the front-end fetches data from the server and displays it. This works fine, but I figured I'd improve upon it by making the client…
finnss
  • 208
  • 2
  • 12
7
votes
2 answers

Sharing sessions between two flask servers

I have a backend with two flask servers. One that handles all RESTfull request and one that is an flask-socketio server. Is there a way how I can share the session variables (Logged in User etc.) between these two applications? They do run over…
Jason
  • 654
  • 1
  • 11
  • 27
7
votes
1 answer

How to make "python -m flask run" run main function?

I'm working with a flask app that's currently launched as follows: The starting command is python -m flask run, where FLASK_APP pointing to __init.py__. __init.py__ simply sets a variable app to an instance of Flask: from .app import get_app app =…
Cedric Reichenbach
  • 8,970
  • 6
  • 54
  • 89
7
votes
1 answer

Using multiple cores with Python and Eventlet

I have a Python web application in which the client (Ember.js) communicates with the server via WebSocket (I am using Flask-SocketIO). Apart from the WebSocket server the backend does two more things that are worth to be mentioned: Doing some…
7
votes
1 answer

How to unittest Flask websocket server (Flask-SocketIO)

I wonder how can I unittest on my flask websocket server. My application supports quite many interface on REST API(Flask-restful) and Web Socket(Flask-SocketIO). All of websocket "emit" are proceed on celery process. I have problem unit-testing…
7
votes
1 answer

RuntimeError: working outside of request context

I am trying to create a 'keepalive' websocket thread to send an emit every 10 seconds to the browser once someone connects to the page, but I'm getting an error and am not sure how to get around it. Any ideas on how to make this work? And how…
user1601716
  • 1,893
  • 4
  • 24
  • 53
6
votes
2 answers

Slow Socket IO response when using Docker

I have a Web App built in Flask where tweets are captured (using Tweepy library) and displayed on the front-end. I used Socket IO to display the tweets live on the front-end. My code works fine when I run this locally. The tweets appear…
Mervin Hemaraju
  • 1,921
  • 2
  • 22
  • 71
6
votes
4 answers

Flask timeout when serve using gunicorn

I have an app that will convert audio file to text. Using flask and flask-socketio. It works perfectly when I run it using: "python run.py", but when I run it using: "gunicorn -k eventlet -b 0.0.0.0:5000 run:app" it will stop on the part where it…
Hokage Sama
  • 153
  • 1
  • 2
  • 12
6
votes
1 answer

CORS request did not succeed in python flask-socketio

I need help in debugging -the Same Origin Policy disallows reading the remote resource at https://some-domain.com. (Reason: CORS request did not succeed) in python flask-socketio error. I am working on a chat application using python flask-socketio.…
VinothRaja
  • 1,405
  • 10
  • 21
6
votes
1 answer

Is there a way to modify a flask session inside a flask-socketio event?

I tried the following: @socketio.on("signup req") def signup_req(json): print(f"Response! {json}") socketio.emit("signup res", "RECEIVED!") session["user"] = {"name": json["name"]} but when I want to access it by…
The Rainbow
  • 98
  • 2
  • 7
6
votes
3 answers

Flask-SocketIO and 400 Bad Request

I'm running a Flask application with socketio to deal with notifications. The Flask app is listening at port 5000 and the client is in 8080. the js client is always getting this error: VM15520:1 GET…
magnoz
  • 1,939
  • 5
  • 22
  • 42
6
votes
2 answers

flask-socket.io: frequent time-outs

I have a flask-socket.io application that is pretty standard: server: eventlet I start the app using: socketio.run(app, host='0.0.0.0') Frequently but not always I have some kind of timeout: Traceback (most recent call last): File…
caliph
  • 1,389
  • 3
  • 27
  • 52
6
votes
2 answers

How to send message from server to client using Flask-Socket IO

I'm trying to create a python app that can send message from server to client. Currently I'm using this sample code from here. It's a chat app and it's working fine. I tried to modified the app and add a new function in the server side python code…
akmalmzamri
  • 1,035
  • 1
  • 15
  • 31
6
votes
1 answer

Disabling logger in Flask Socket.io

I have an application using Flask and FlaskSocket.IO 2.8.4. When I initialise SocketIO, I am using #[...] logging.basicConfig(level=logging.DEBUG,format='[%(asctime)s][%(levelname)s] - %(funcName)s: %(message)s') logger =…
6
votes
2 answers

Flask-SocketIO server using polling instead of websockets

I'm working on a Flask-SocketIO server that works just fine. However, I'm getting lots of requests like this in my server log: "GET /socket.io/?EIO=3&transport=polling&t=LBS1TQt HTTP/1.1" Here's the code I'm working with: from flask import Flask,…
RPiAwesomeness
  • 5,009
  • 10
  • 34
  • 52
1 2
3
70 71