-
-
Notifications
You must be signed in to change notification settings - Fork 543
client : how to keep open connection and send messages #559
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
Comments
I don't understand what you're trying to achieve sufficiently well to understand your problem. Perhaps you could start from the examples in the docs and explain why they don't do what you need? |
well, i already have a working prototype for sending a single command, see : jalien_py |
Try using a loop? while True:
message = await websocket.recv()
do_stuff(message) |
that's perfect!!! thanks a lot!! |
The WebSocket protocol uses a persistent connection and delimits messages (it's a TLV protocol). ConnectionClosed indicates that the connection dropped (and you need to reopen it if you want to interact with the server again), not that you reached the end of a message. I'm not sure I understood your question very well. I hope this helps anyway. |
Hi @aaugustin ! First let me thank you for taking you time to help me :)
Unfortunately, i cannot inspect the traffic as it is openssl only and i could not setup wireshark to to use private ca and certs |
You're misinterpreting the code: you're confusing "receiving messages" and "closing the connection when no more messages will be received". You do not need the server to close the connection to receive messages. |
@aaugustin I see.. then i am stuck because i don't know how to continue ... given that i can communicate just fine with an ws echo server can you help me with an idea avout how can i debug why i receive nothing from this particular server even if the server says that it received my message and sent the answer? |
Try enabling logging? https://websockets.readthedocs.io/en/stable/cheatsheet.html#debugging I'm familiar with some common issues — that's how I knew to tell you "write a |
i had the logging but it was only INFO not debug ...
Any idea about this? Can i assure the upstream service that they actually they did not send anything back? |
Indeed, they didn't. |
I'm going to close this issue as we haven't found a bug in websockets. Please follow-up if you do! |
thanks a lot for your help and your great work!! |
Hi! I am trying to do some kind of interface shell to a websocket service so i need to keep the connection/application open to take the input and get the messages .. is there a way to do this?
Thank you!
The text was updated successfully, but these errors were encountered: