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:
|
else:
|
||||||
socketio.emit("busy", "busy", to=session[id])
|
socketio.emit("busy", "busy", to=session[id])
|
||||||
else:
|
else:
|
||||||
socketio.emit("error", "error")
|
socketio.emit("error", "error", to=session[id])
|
||||||
|
leave_room(session[id])
|
||||||
|
|
||||||
@app.route("/removetag", methods=['GET'])
|
@app.route("/removetag", methods=['GET'])
|
||||||
def get_removetag_request():
|
def get_removetag_request():
|
||||||
|
@ -147,18 +148,19 @@ def get_removetag_request():
|
||||||
@socketio.on('removetag')
|
@socketio.on('removetag')
|
||||||
def request_removetag(data):
|
def request_removetag(data):
|
||||||
global finished
|
global finished
|
||||||
|
join_room(session[id])
|
||||||
if len(users.queue) > 0:
|
if len(users.queue) > 0:
|
||||||
user = users.queue[len(users.queue) - 1]
|
user = users.queue[len(users.queue) - 1]
|
||||||
print(user)
|
print(user)
|
||||||
print(session[id])
|
print(session[id])
|
||||||
if user == [data["data"], "remove", session[id]]:
|
if user == [data["data"], "remove", session[id]]:
|
||||||
socketio.emit("wait", "wait")
|
socketio.emit("wait", "wait", to=session[id])
|
||||||
i = 0
|
i = 0
|
||||||
while finished != [data["data"], "remove", session[id]]:
|
while finished != [data["data"], "remove", session[id]]:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
i += 1
|
i += 1
|
||||||
if i > 20:
|
if i > 20:
|
||||||
socketio.emit("error", "timeout")
|
socketio.emit("error", "timeout", to=session[id])
|
||||||
notimportant = users.get()
|
notimportant = users.get()
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
@ -169,9 +171,10 @@ def request_removetag(data):
|
||||||
tag_id = c.fetchall()[0][0]
|
tag_id = c.fetchall()[0][0]
|
||||||
socketio.emit("finished", f"removed {tag_id} from {username}")
|
socketio.emit("finished", f"removed {tag_id} from {username}")
|
||||||
else:
|
else:
|
||||||
socketio.emit("busy", "busy")
|
socketio.emit("busy", "busy", to=session[id])
|
||||||
else:
|
else:
|
||||||
socketio.emit("error", "error")
|
socketio.emit("error", "error", to=session[id])
|
||||||
|
leave_room(session[id])
|
||||||
|
|
||||||
#api
|
#api
|
||||||
@app.route("/api/tag_id", methods=['GET'])
|
@app.route("/api/tag_id", methods=['GET'])
|
||||||
|
|
Loading…
Reference in a new issue