def test_disconnect():
# here we have to use the sid to locate the the disconnected device
# and if it exists, remove its room and set it as unaceessable
try:
close_room(request.sid)
except Exception as e:
logging.debug(e)
# Remove token if exist
global tokens
token = request.args.get('token', '')
if token in tokens:
tokens.remove(token)
logging.debug("Token removed:" + token)
# disconnect()
print('Client disconnected: ', request.sid)
# @app.route('/')
# def index():
# return render_template('index.html', async_mode=socketio.async_mode)
# @socketio.on('request', namespace = mynamespace)
# def broadcast_message(message):
# message = {'data': {'message': 'I am the message'}}
# emit('response',
# {'data': message['data']['message']},
# broadcast=True)
评论列表
文章目录