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
2
votes
1 answer

“RuntimeError: working outside of request context" when using a generator to stream data with Flask

I encountered the RuntimeError: working outside of request context error while trying to build a webhook using the Python Flask framework. This is the app_producer.py file that sends HTTP POST requests: from flask import Response,…
2
votes
0 answers

Flask-SocketIO app not deploing to Railway - tcp protocol error

I am trying to deploy an app that is working fine locally, but in Railway the build fails: Error: class uri 'eventlet' invalid or not found: [Traceback (most recent call last): File "/opt/venv/lib/python3.9/site-packages/gunicorn/util.py", line 99,…
Dan
  • 21
  • 2
2
votes
1 answer

How can I get SocketIO to work in Docker when it's working locally?

My Flask app works locally when I run flask run -p 8000 but when I try to run this in Docker my SocketIO events don't seem to be getting through from the server to the client. Here's an example app to show what I mean: Flask app: import flask from…
Alistair
  • 433
  • 7
  • 18
2
votes
2 answers

Flask socketio not listening to events

I'm building a flask app utilizing flask socketio. I'm running it locally on Ubuntu 20.04 with gunicorn and eventlet on localhost:8000. My server side test code looks like this: $(document).ready(function() { // const socketGame =…
João A. Veiga
  • 498
  • 3
  • 11
2
votes
1 answer

SocketIO(app) missing required positional argument 'mode'

I'm trying to get the simple example of Flask-SocketIO working, but I'm getting an error saying I'm missing a required positional argument 'mode', even though the documentation / official example don't show such a parameter:
Nathan Wailes
  • 9,872
  • 7
  • 57
  • 95
2
votes
1 answer

Flask-SocketIO - WebSocket is closed before the connection is established. [Heroku]

While running Flask on my local server everything was fine, but after moving to Heroku I started getting "WebSocket is closed before the connection is established." In my localserver websocket is connected once, but on heroku it keeps connecting to…
2
votes
1 answer

Flutter's web_socket_channel fails silently

Trying to follow https://flutter.dev/docs/cookbook/networking/web-sockets a minimalistic flutter program, trying to send a message to my server: import 'package:flutter/material.dart'; import…
2
votes
1 answer

Socket-IO is using Polling instead of Websocket

I'm working on an application that uses Flask-SocketIO server with Vue.js on the client side. The issue is that when the app is deployed on NGINX server (version 1.21), it always uses polling and I keep getting following…
Talal Zahid
  • 128
  • 2
  • 12
2
votes
0 answers

Launching thread many times vs looping flask-socketIO

I have a flask server with socketIO (flask-socketIO) that produces many screen grabs per second. Each time it grabs the screen it sends the screen (as binary data) to the flask-socketIO server for processing. This processing is computationally…
Kevin
  • 3,077
  • 6
  • 31
  • 77
2
votes
0 answers

Flask Session loses login session data on refresh

I'm currently building a Chat App using Flask and Flask Socketio. In order to save the client's current chat-room, I use the flask_session module with the session type "filesystem". I also use Flask-Login module so the client is logged in with an…
2
votes
0 answers

websocket works in all browsers but not cordova + simulator?

Running server locally. Tested client via all browsers, works well, but once on Cordova and trying it on Simulator (as well as on device), it fails with (per Safari Technology Preview): WebSocket connection…
KalleJuhans
  • 129
  • 2
  • 10
2
votes
1 answer

Flask-SocketIO server deploys to Heroku but doesn't run

I have a simple Flask-SocketIO server on Python and a SocketIO_Client which emits data to the server, where it gets printed in the console once received. It all works fine on a localhost, however when trying to host the server on Heroku it…
2
votes
1 answer

Sending events from Celery task - Flask-SocketIO + Celery

I'm trying to send events from a Celery task to the server, so I can send data to the Client. A User submits a form with text The server receives the form submission The server sends the form data to the Celery task queue Celery processes the…
Dr. Funkenstein
  • 416
  • 4
  • 14
2
votes
0 answers

"GET /socket.io/?EIO=3&transport=websocket HTTP/1.1" error

Hi I have following flask socketio code from flask import Flask, request, jsonify from flask_socketio import SocketIO app = Flask(__name__) app.secret_key = 'secret' async_mode=None socketio =…
user13116294
2
votes
1 answer

FlaskApp - Setup VS Code Debugger after install flask-socketio extension

I'm running a flask rest api using vscode as the IDE. I could setup the VSCode launcher in order to debug the application. launch.json { "name": "Python: Flask", "type": "python", "request": "launch", "module":…