Validasi token di soket flask

// Client

var socket = io("http://localhost:5000", {
  extraHeaders: {
    "X-My-Auth": "your-token-here"
  }
});


// Server

@socketio.event
def connect():
    token = request.headers['X-My-Auth']
    if not verify_token(token):
        return False
    # user is authenticated, proceed normally from here on
Salo Hopeless