Flask-SocketIO-Chat | simple chat application that demonstrates how to structure | Socket library
kandi X-RAY | Flask-SocketIO-Chat Summary
kandi X-RAY | Flask-SocketIO-Chat Summary
A simple chat application that demonstrates how to structure a Flask-SocketIO application. To run this application install the requirements in a virtual environment, run python chat.py and visit on one or more browser tabs.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- View function .
- Create Flask application .
- Render a chat page .
- Called when the client is joined .
- Leave the room .
- Emit text message .
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
You can use Flask-SocketIO-Chat like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
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