Журналы:
Код: Выделить всё
Attempting WebSocket connection to wss://xxxxx.com/socket.io/?transport=websocket&EIO=4
WebSocket connection accepted with {'sid': 'oEzodR82DV63LAfWAAED', 'upgrades': [], 'pingInterval': 25000, 'pingTimeout': 5000}
Engine.IO connection established
Sending packet MESSAGE data 0{}
Received packet MESSAGE data 0
Namespace / is connected
connected!
Emitting event "add user" [/]
Sending packet MESSAGE data 2["add user","Testing"]
Received packet MESSAGE data 2["login",{'userCount': 24}]
Received event "login" [/]
login: {'userCount': 24}
packet queue is empty, aborting
Exiting write loop task
Unexpected error decoding packet: "Invalid empty packet received", aborting
Waiting for write loop task to end
Engine.IO connection dropped
disconnected!
Connection failed, new attempt in 0.50 seconds
Exiting read loop task
Код: Выделить всё
import socketio
sio = socketio.Client(logger=True, engineio_logger=True)
@sio.event
def connect():
print('connected!')
sio.emit('add user', 'Testing')
@sio.on('login')
def login(data):
print(f'login: {data}')
@sio.event
def connect_error(data):
print(f'connection error: {data}')
@sio.event
def disconnect():
print('disconnected!')
sio.connect('https://xxxxx.com', transports=['websocket'])
sio.wait()
Подробнее здесь: https://stackoverflow.com/questions/772 ... g-aborting
Мобильная версия