Skip to content

Commit

Permalink
Support refresh_token message
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Sep 19, 2024
1 parent de66f53 commit 913c238
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hypha/VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "0.20.35.post5"
"version": "0.20.35.post6"
}
8 changes: 8 additions & 0 deletions hypha/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,14 @@ async def send_bytes(data):
data = json.loads(data)
if data.get("type") == "ping":
await websocket.send_text(json.dumps({"type": "pong"}))
elif data.get("type") == "refresh_token":
reconnection_token = generate_reconnection_token(
user_info,
expires_in=self.store.reconnection_token_life_time,
)
conn_info = {"type": "reconnection_token"}
conn_info["reconnection_token"] = reconnection_token
await websocket.send_text(json.dumps(conn_info))
else:
logger.info("Unknown message type: %s", data.get("type"))
except json.JSONDecodeError:
Expand Down

0 comments on commit 913c238

Please sign in to comment.