pythonasyncioeventletgeventlong-pollinglow-latencysocket-iosocketiosocketio-serverweb-serverwebsocket
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
464 B
29 lines
464 B
import asyncio
|
|
|
|
import socketio
|
|
|
|
sio = socketio.AsyncClient()
|
|
|
|
|
|
@sio.event
|
|
async def connect():
|
|
print("connected to server")
|
|
|
|
|
|
@sio.event
|
|
async def disconnect(reason):
|
|
print("disconnected from server, reason:", reason)
|
|
|
|
|
|
@sio.event
|
|
def hello(a, b, c):
|
|
print(a, b, c)
|
|
|
|
|
|
async def start_server():
|
|
await sio.connect("http://localhost:5000", auth={"token": "my-token"})
|
|
await sio.wait()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(start_server())
|
|
|