Flask-Login + Flask-Sockets = Chaos

Viewed 722

I have installed Flask-Login and Flask-Sockets. Both of them work fine HOWEVER when I try to get the current user (using g.user), I get an AttributeError: '_AppCtxGlobals' object has no attribute 'user'

@sockets.route('/echo')
def echo_socket(ws):
    with app.app_context():
        user = current_user #This causes problems, just like basically anything else that uses something that is not provided in this function
        while True:
            message = ws.receive()
            ws.send("lol")

I am still new with Flask, any help would be super appreciated.

1 Answers
Related