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

gevent with uwsgi requires ping/pong #417

Closed
MattWycklendt opened this issue Feb 27, 2017 · 5 comments
Closed

gevent with uwsgi requires ping/pong #417

MattWycklendt opened this issue Feb 27, 2017 · 5 comments
Assignees
Labels

Comments

@MattWycklendt
Copy link

I am having an issue where the client does not receive emits from the server unless it sends a message. To recreate the issue run the example app in the Flask-SocketIO library and comment out the ping/pong functions in the client library (currently lines 38 to 57). Run the server with uwsgi and gevent using the command listed in the docs. If I send an ECHO message to the server the client doesn't get any response back until sending another ECHO message.

@MattWycklendt
Copy link
Author

Note that the ping I am talking about is not the engineIO ping timeout. This issue occurs immediately after the web socket connection.

@miguelgrinberg
Copy link
Owner

miguelgrinberg commented Mar 2, 2017

When you say

If I send an ECHO message to the server the client

Do you mean typing ECHO in the first text box from the example in this repository, or is it something else? If you are using your own code, messages that are sent do not receive a response, unless you request a callback.

@MattWycklendt
Copy link
Author

@miguelgrinberg Sorry, I probably wasn't clear in my description. I am not using my own code, only the example code provided in the repo with a couple lines commented out. Below are more detailed steps:

  1. I cloned the Flask-SocketIO library.
  2. I installed gevent and uwsgi in my virtual environment.
  3. In /examples/templates/index.html I commented out the interval timer to emit a my_ping message, and listen to my_pong message. This is equivalent to commenting out lines 38 to f7.
  4. Run the app with uwsgi in the example directory using the command uwsgi --http :5000 --gevent 1000 --http-websockets --master --wsgi-file app.py --callable app
  5. In the browser start sending messages in the first echo text box. If I type msg1 I expected to see that echoed back but nothing happened. If I enter msg2 in the text box I see msg1 come back. If I then enter msg3 in the text box I see msg2 come back... Basically I was only recieving echo messages from the server after entering another echo message.

@miguelgrinberg
Copy link
Owner

Sorry for the misunderstanding. I have now reproduced the issue.

It appears I inadvertently introduced this bug in miguelgrinberg/python-engineio@d158423, by changing the method to read the websocket file handle.

Please upgrade python-engineio to version 1.2.4. I think with that upgrade uwsgi will behave.

@miguelgrinberg miguelgrinberg self-assigned this Mar 2, 2017
@MattWycklendt
Copy link
Author

Working. Thanks!

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

No branches or pull requests

2 participants