Am doing a project with Flask, Gevent and web socket using flask development server environment. I used flask_login
. Here
SessionID
in the Database and delete it once client disconnects.How to get total active connections
from flask_login import *
login_manager = LoginManager()
login_manager.setup_app(app)
@app.route("/", methods=["GET", "POST"])
def login():
login_user([username], remember):
@app.route("/logout")
@login_required
def logout():
logout_user()
Session IDs are typically found in the Request (NCSA) field, the URI-Query (W3C), or the Cookie field: If the ID is found in the URL itself, it will be in the Request field for Apache servers and in the URI Query field for IIS servers.
By default, Flask-Login uses sessions for authentication. This means you must set the secret key on your application, otherwise Flask will give you an error message telling you to do so.
Flask-Session is an extension for Flask that supports Server-side Session to your application. The Session is the time between the client logs in to the server and logs out of the server. The data that is required to be saved in the Session is stored in a temporary directory on the server.
There is no session id.
Sessions in Flask are simply wrappers over cookies. What you save on it it's digitally signed and sent as a cookie to the client. When you make a request, that cookie is sent to your server and then verified and transformed in a Python object.
AFAIK, Flask-Login saves on the session the user ID.
To get total active connections, you can:
flask.session['uid'] = uuid.uuid4()
, for example), then save it on your database.del flask.session['uid']
) and also from your database.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With