Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client not recieve message when disconnect with rabbitmq as message queue. #453

Closed
Nriver opened this issue May 3, 2017 · 2 comments
Closed
Assignees

Comments

@Nriver
Copy link

Nriver commented May 3, 2017

I modified the example application to add rabbitmq support with:
socketio = SocketIO(app, async_mode=None, message_queue='amqp://')
It worked fine when I send simple messages and mess around with rooms. When I try to use disconnect, the server recieved the disconnect request then do emit a "Disconnected!" message and disconnect. However, the client coud not recieve the message and the connection got closed.

Then I tried redis message queue with:
socketio = SocketIO(app, async_mode=None, message_queue='redis://')
This time the client showed the "Disconnected!" message.

Any idea why rabbitmq doesn't work?

@miguelgrinberg
Copy link
Owner

miguelgrinberg commented May 3, 2017

I wonder if it is just a timing thing. Maybe rabbitmq is a slightly bit slower in delivering the message, and the disconnect happens first. Try adding a socketio.sleep(1) in between the emit and the disconnect calls to see if that makes it work. If that does it, then I think it is timing. Emitting and immediately disconnecting isn't really a great idea anyway, normally if you want to make sure the message is delivered before disconnecting you would use a callback, and then disconnect in the callback. I should probably update the example to do it that way, come to think of it.

@ghost
Copy link

ghost commented Jan 8, 2018

any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants