V
V
vutmuk1232021-02-23 17:26:06
Python
vutmuk123, 2021-02-23 17:26:06

Python-socketio is a simple server-client. Should sio.wait() work?

Hello. I'm learning websockets. Copy-pasted a simple client-server from the python-socketio documentation. It works, there is a connection between the server and the client. Next, I added a separate process to the server to send a message to the client from the keyboard. And now the message does not come to the client) I would not like to bother you with the code, but there is a question. In the main thread of the client, after the connection, sio.wait() works:

async def main():
    await sio.connect('http://localhost:8080/')
    await sio.wait()

The documentation says:
If the application has nothing to do on the main thread and just wants to wait for the connection to the server to complete, it can call the wait() method:
sio.wait()
Or in the asyncio version:
await sio.wait()

The paycharm tooltip says:
Wait until the connection with the server ends.
Client applications can use this function to block the main thread during the life of the connection.

Those. does the wait method delay the client's work until the connection is completed? So this is like a stub for demonstrating performance? Does this mean that it should be replaced with a method waiting for some kind of request, or should wait always be on the thread?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question