first commit
This commit is contained in:
24
test/wsc.py
Normal file
24
test/wsc.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import asyncio
|
||||
import socketio
|
||||
|
||||
sio = socketio.AsyncClient()
|
||||
|
||||
@sio.event
|
||||
async def connect():
|
||||
print('connection established')
|
||||
|
||||
@sio.event
|
||||
async def my_message(data):
|
||||
print('message received with ', data)
|
||||
await sio.emit('my response', {'response': 'my response'})
|
||||
|
||||
@sio.event
|
||||
async def disconnect():
|
||||
print('disconnected from server')
|
||||
|
||||
async def main():
|
||||
await sio.connect('http://localhost:8000')
|
||||
await sio.wait()
|
||||
|
||||
if __name__ == '__main__':
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user