Skip to content

Commit

Permalink
disconnect websockets on logout
Browse files Browse the repository at this point in the history
  • Loading branch information
srgooglo committed Nov 28, 2023
1 parent 556bd9f commit 1b679d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/app/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,10 @@ class ComtyApp extends React.Component {
app.eventBus.emit("layout.animations.fadeIn")
},
"auth:logout_success": async () => {
app.cores.api.disconnectWebsockets()

app.navigation.goAuth()

await this.flushState()
},
"session.invalid": async (error) => {
Expand Down
3 changes: 2 additions & 1 deletion packages/app/src/cores/api/api.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import createClient from "comty.js"
import measurePing from "comty.js/handlers/measurePing"
import request from "comty.js/handlers/request"
import useRequest from "comty.js/hooks/useRequest"
import { reconnectWebsockets } from "comty.js"
import { reconnectWebsockets, disconnectWebsockets } from "comty.js"

export default class APICore extends Core {
static namespace = "api"
Expand All @@ -25,6 +25,7 @@ export default class APICore extends Core {
measurePing: measurePing,
useRequest: useRequest,
reconnectWebsockets: reconnectWebsockets,
disconnectWebsockets: disconnectWebsockets,
}

listenEvent(key, handler, instance) {
Expand Down

0 comments on commit 1b679d4

Please sign in to comment.