SocketIO callback received in the message queue, but the callback isn't executed #2105
-
Hi, I am currently having issues with the Here is the basic setup of the load balancer:
This is the flask socketio setup:
I am using gunicorn and gevent as the workers, and each gunicorn worker is created to bind to one port, with only 1 worker:
The issue:The code works locally, and also on AWS when using only a single node. Socketio callback functions work in the pure socketio context, aka when the callback is emitted from a socketio context. However, with multiple nodes, it does not work when the server emits an event in the http context. The client responds fine, and both the engineIO logs and the pubsub caught the message, the namespace, sid, and callback id are all matched. There is also one single client in the emit. I have a feeling that it is because it is being handled by a different worker because the code works locally, and also works when there is only one worker. I wonder the more "appropriate way" of handling this is to have the client emit an event instead of using the callback I am currently using the old flask socketio version of 2.0.1. The change logs don't seem to have updates for this. I probably might be wrong while skimming through the updates. Just want to know the best way of handling this if anyone has encountered similar problems. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The issue is probably caused by using two load balancers instead of one, which seems like a strange thing to do. Do callbacks work if you drop the AWS balancer and use only nginx? |
Beta Was this translation helpful? Give feedback.
The issue is probably caused by using two load balancers instead of one, which seems like a strange thing to do. Do callbacks work if you drop the AWS balancer and use only nginx?