Skip to content

Instantly share code, notes, and snippets.

@anandtripathi5
Last active February 27, 2022 20:52
Show Gist options
  • Save anandtripathi5/0a1df3b5008aa75e39dd2a25cfd443ff to your computer and use it in GitHub Desktop.
Save anandtripathi5/0a1df3b5008aa75e39dd2a25cfd443ff to your computer and use it in GitHub Desktop.
from flask_socketio import Namespace, disconnect
from flask import current_app as app
from extensions import db
class BaseSocket(Namespace):
def on_connect(self):
pass
def on_disconnect(self):
disconnect()
app.logger.info("socket disconnected")
db.session.remove() # this is important
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment