Skip to content

Troubles while using test client and emitting from background thread. #2039

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

You must be logged in to vote

You are using the Flask-SocketIO test client, which is not a real client, it runs directly in the server's context. The case that you think is working is actually running a second server in your client's container, and your test client is actually connecting to that server. You can see the server emitting in the log of your working client above. In the non-working case your client is running but the server is not, so the client connects and does not receive anything.

If you want to run a real client-server test then you can't use the Flask-SocketIO test client, in that case you need to use a real Socket.IO client that connects over the network.

Replies: 1 comment 2 replies

Comment options

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

@miguelgrinberg
Comment options

Answer selected by heitorc62
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