room specifik socketio emit
This commit is contained in:
parent
068e227e22
commit
46323b0ef4
1 changed files with 8 additions and 5 deletions
13
main.py
13
main.py
|
@ -130,7 +130,8 @@ def request_addtag(data):
|
|||
else:
|
||||
socketio.emit("busy", "busy", to=session[id])
|
||||
else:
|
||||
socketio.emit("error", "error")
|
||||
socketio.emit("error", "error", to=session[id])
|
||||
leave_room(session[id])
|
||||
|
||||
@app.route("/removetag", methods=['GET'])
|
||||
def get_removetag_request():
|
||||
|
@ -147,18 +148,19 @@ def get_removetag_request():
|
|||
@socketio.on('removetag')
|
||||
def request_removetag(data):
|
||||
global finished
|
||||
join_room(session[id])
|
||||
if len(users.queue) > 0:
|
||||
user = users.queue[len(users.queue) - 1]
|
||||
print(user)
|
||||
print(session[id])
|
||||
if user == [data["data"], "remove", session[id]]:
|
||||
socketio.emit("wait", "wait")
|
||||
socketio.emit("wait", "wait", to=session[id])
|
||||
i = 0
|
||||
while finished != [data["data"], "remove", session[id]]:
|
||||
time.sleep(1)
|
||||
i += 1
|
||||
if i > 20:
|
||||
socketio.emit("error", "timeout")
|
||||
socketio.emit("error", "timeout", to=session[id])
|
||||
notimportant = users.get()
|
||||
break
|
||||
else:
|
||||
|
@ -169,9 +171,10 @@ def request_removetag(data):
|
|||
tag_id = c.fetchall()[0][0]
|
||||
socketio.emit("finished", f"removed {tag_id} from {username}")
|
||||
else:
|
||||
socketio.emit("busy", "busy")
|
||||
socketio.emit("busy", "busy", to=session[id])
|
||||
else:
|
||||
socketio.emit("error", "error")
|
||||
socketio.emit("error", "error", to=session[id])
|
||||
leave_room(session[id])
|
||||
|
||||
#api
|
||||
@app.route("/api/tag_id", methods=['GET'])
|
||||
|
|
Loading…
Reference in a new issue