flask-socketio-chat | A basic chat app created using Flask-SocketIO | Socket library
kandi X-RAY | flask-socketio-chat Summary
kandi X-RAY | flask-socketio-chat Summary
This code goes along with this video: It covers a simple SocketIO app in Flask.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of flask-socketio-chat
flask-socketio-chat Key Features
flask-socketio-chat Examples and Code Snippets
Community Discussions
Trending Discussions on flask-socketio-chat
QUESTION
I have a basic flask socket.io chat app that's built the same as this example https://github.com/miguelgrinberg/Flask-SocketIO-Chat
I can run the app with gunicorn mychat:app --worker-class eventlet -w 1 --bind 0.0.0.0:5000 --reload
and then autossh -M 0 -R myappname:80:localhost:5000 serveo.net
and hitting the appropriate serveo.net url.
I'm trying to deploy this on an AWS EC2 instance behind a loadbalancer with HTTPS. On the EC2 instance I installed nginx as here: https://flask-socketio.readthedocs.io/en/latest/#using-nginx-as-a-websocket-reverse-proxy (the single example, not the multiple nodes example).
When I go to the URL I defined from my loadbalancer target group, and i enter a chatroom, I see that in the Network tab of my browser, there are tons of rapid polling requests that keep giving a 200 then a 301. If I join the chatroom in another tab, the users are not able to send message to each other.
What is wrong with my configuration?
...ANSWER
Answered 2019-Feb-20 at 22:29After digging around, I figured it out. My host, example.com, points to a load balancer with a bunch of listener rules. I made it so that if path=/mychatapp/*, then forward to the ec2 instance running the app. This is fine, but socket.io was making calls with host=example.com so it was hitting example.com/socket.io/etcetcetc... I added another load balancer listener rule if path=/socket.io/*, then also forward it to the ec2 instance. This works out.
This solution is pretty hacky since it means I couldn't run a second socket.io app. A better answer would be to somehow change the default call from "/socket.io" to "/mychatapp/socket.io" so that I wouldn't require another listener rule. I tried a few ways to do this, but it didn't work. Since this is a small project, I will stick with this solution.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install flask-socketio-chat
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page