Skip to content

Python Client + Node Server not working #1243

Closed Answered by miguelgrinberg
neeyanthkvk asked this question in Q&A
Discussion options

You must be logged in to vote

The emit method in the Python client does not wait for the data to be transmitted. You are doing your emits and then immediately disconnecting, without giving time to the messages to arrive.

You have a few options to address this:

  1. Add a sleep after the emits and before the disconnect. This is technically a hack, since you have no way to know how long it will take for the messages to be delivered.
  2. Use acknowledgement callbacks to let the server notify you when the message was received. Callbacks in Python are strange and far from Pythonic, so this isn't a great option. If you go with this, the JS side also needs to be edited to use callbacks.
  3. Use the call() method instead of emit(). The c…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@neeyanthkvk
Comment options

@neeyanthkvk
Comment options

Answer selected by miguelgrinberg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants