miguelgrinberg / Flask-SocketIO-Chat

A simple chat application that demonstrates how to structure a Flask-SocketIO application.
http://blog.miguelgrinberg.com/post/easy-websockets-with-flask-and-gevent
MIT License
673 stars 239 forks source link

Scaling with Redis #16

Closed cheickmec closed 5 years ago

cheickmec commented 6 years ago

I have been trying to slightly modify the code to use my local instance of Redis by providing it with the redis:// argument as the message_queue argument on the following https://github.com/miguelgrinberg/Flask-SocketIO-Chat/blob/41f2627ad89e0f01b261f52372292ad507d3d3cb/app/__init__.py#L16 becomes socketio.init_app(app, message_queue='redis://'). According to my reading of the documentation, that is all I need for accomplishing what I'm attempting here and it does seem to work to some extent because when I monitor my redis from another terminal (redis-cli monitor), I see the application subscribing to the flask-socketio channel once I fill out the initial form for joining a room. However, after being redirected to the chat room page, socketio attempts to make a connection to the server multiple times but all those requests never seem to return as they show up as pending in my Chrome dev tools. Below is a screenshot of that.

screen shot 2018-03-07 at 7 18 53 am

Have I missed something in the configuration step for this?The behavior I'm expecting is to be able to instantiate two servers on different ports and let's say I join room 1 on both from different browser windows, then I should be able to send a message from one window to the other. I have done something similar in NodeJs and it worked fine but I'm having trouble replicating the same behavior here.

miguelgrinberg commented 5 years ago

This issue will be automatically closed due to being inactive for more than six months. Please reopen if you need more assistance.