mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
Merge pull request #1730 from GSA/update-register_socket_handlers
Added @socketio.on(connect) and @socketio.on(disconnect)
This commit is contained in:
@@ -3,6 +3,17 @@ from flask_socketio import join_room, leave_room
|
||||
|
||||
|
||||
def register_socket_handlers(socketio):
|
||||
@socketio.on("connect")
|
||||
def on_connect():
|
||||
current_app.logger.info(
|
||||
f"Socket {request.sid} connected from {request.environ.get('HTTP_ORIGIN')}"
|
||||
)
|
||||
return True
|
||||
|
||||
@socketio.on("disconnect")
|
||||
def on_disconnect():
|
||||
current_app.logger.info(f"Socket {request.sid} disconnected")
|
||||
|
||||
@socketio.on("join")
|
||||
def on_join(data): # noqa: F401
|
||||
room = data.get("room")
|
||||
|
||||
Reference in New Issue
Block a user