【发布时间】:2021-10-29 13:29:52
【问题描述】:
hii 我正在尝试使用 socketio python 构建客户端。 捕获事件时如何打破循环
def login():
index = 0
while index == 0:
username = input("please enter your username\n")
password = input("please enter your password\n")
sio.emit('send user name and password', {"username": username, "password": password})
@sio.on('wrong username')
def print_message():
print("this username is not exist")
@sio.on('wrong password')
def print_message():
print("your password is wrong please try again")
@sio.on('connected')
def print_message():
global index
index = 1
print("LOGIN OK")
sio.sleep(2)
【问题讨论】:
标签: python socket.io client python-socketio