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
10
votes
2 answers

Eventlet + DNS Python Attribute Error: module "dns.rdtypes" has no attribute ANY

I know that someone will face this problem. I had this problem today, but I could fix it promptly, and I want to share my solution: Problem: from flask_socketio import SocketIO You will receive an output error with something like: Attribute Error:…
10
votes
4 answers

ImportError: cannot import name 'run_with_reloader' from 'werkzeug.serving'

I am getting the following error when I try to run the backend of my web application: ImportError: cannot import name 'run_with_reloader' from 'werkzeug.serving'. It is coming from within the \lib\site-packages\werkzeug\serving.py file. I think it…
watersheep23
  • 339
  • 1
  • 3
  • 17
10
votes
1 answer

Running Websockets with Google Cloud Platform

I have a flask app that runs both flask and flask-socketio endpoints. When i went to deploy on google App engine, i realized that websockets are not supported by app engine. this means that i need to use compute engine for my flask-socketio and app…
9
votes
1 answer

What is a preferred production setup for Flask-SocketIO? Confused about Gunicorn as it can only be spawned with one worker

From the deployment section in the documentation, Gunicorn can only work with 1 worker process with Flask-SocketIO. I was wondering what is the preferred way to deploy a flask-socket-io server? Currently I have a regular Flask app that uses a…
fibonachoceres
  • 727
  • 4
  • 14
9
votes
1 answer

Flask socket.io message events in different files

socketservice.py: from flask import Flask, render_template from flask_socketio import SocketIO, emit from backend.database import db app = Flask(__name__) socketio = SocketIO(app, engineio_logger=True) @socketio.on('connect') def…
netik
  • 1,736
  • 4
  • 22
  • 45
8
votes
1 answer

Extending Flask REST API with WebSockets

I am currently working on extending my existing REST API created using Flask-RESTPlus with WebSocket support. The idea is to create a Web Thing Model compliant Web Thing (Gateway). The "Things" in my use-case are dynamically added or removed. The…
Pieter Moens
  • 331
  • 1
  • 4
  • 14
8
votes
1 answer

Flask socket IO emit from another module

I have almost read every piece of article available on the internet but nothing seems to work for my case. I have installed flask-socketio and everything works fine until I emit the messages from a module other than app.py. I have tried several ways…
Manali Kagathara
  • 743
  • 4
  • 11
8
votes
2 answers

Heroku sock=backend Server Request Interrupted for a Flask SocketIO application

I have a flask-socketio app hosted on heroku with the following Procfile : web: gunicorn --worker-class eventlet hello:app Ever since I switched to socketio, the app has been behaving inconsistenly. Earlier the app would run for a while and then…
Denny George
  • 535
  • 1
  • 6
  • 19
8
votes
1 answer

Flask SocketIO send message from server to room

In my app, I need the client to join a room so that it may then receive messages from my server. Server Code @socketio.on('join', namespace='/test') def join(message): join_room(message['room']) room = message['room'] emit('my…
user2268507
8
votes
3 answers

Exception gevent.hub.LoopExit: LoopExit('This operation would block forever',)

I am always getting this error when running my Flask App with Websockets. I have tried to follow this guide - http://blog.miguelgrinberg.com/post/easy-websockets-with-flask-and-gevent I have a flask app that provides the GUI interface for my network…
7
votes
2 answers

Flask, FlaskSocketIO - RuntimeError: Cannot obtain socket from WSGI environment

When I try to use the functionality that uses websockets in my application, I get this error in the console: File "/Users/user/venv/lib/python3.7/site-packages/simple_websocket/ws.py", line 138, in __init__ raise RuntimeError('Cannot obtain…
Dr. Funkenstein
  • 416
  • 4
  • 14
7
votes
3 answers

Flask-SocketIO send images

I am currently working on a project that uses Flask-SocketIO to send things over the internet, but I came across this question. Question: Is there any way to send images in Flask-SocketIO? I did some googling but no luck for me.
Brian Zheng
  • 439
  • 5
  • 18
7
votes
2 answers

Flask-socketio - failed to set "Access-Control-Allow-Origin" response header

I wrote this simple flask-socketio code: from flask import Flask from flask_socketio import SocketIO, send app = Flask(__name__) app.config['SECRET_KEY'] = 'mysecret' socketio = SocketIO(app) @socketio.on('message') def handle_message(msg): …
Billie
  • 8,938
  • 12
  • 37
  • 67
7
votes
1 answer

Socket connection breaking frequently with flask-socketio

I am using flask-socketio to make a socket connection from my python web server to the javascript client. I am able to establish the connection but it breaks in a while(5 seconds or so) with the error socket.io.min.js:2 WebSocket connection to …
Vipul J
  • 6,641
  • 9
  • 46
  • 61
7
votes
2 answers

Using Flask-socketio and the socketIO client

I'm currently trying to understand how sockets work. I'm using Flask-socketio and a python socketio client and running through a basic example. Here is what I have done so far app.py from flask import Flask, render_template from flask_socketio…
Deepika Kapoor
  • 133
  • 1
  • 1
  • 9
1
2
3
70 71