You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the opened issues and there are no duplicates
Describe the requested feature
I am trying to use authentication in my application, and it works correctly on web. However, when using a mobile device in the web, after completing the authentication process and being redirected to the authentication page, the server assumes the client has disconnected. As a result, the server immediately restarts.
This behavior causes a problem: when the authentication process finishes, the server has already disconnected the session. The client tries to reconnect, but the session has been terminated, resulting in errors.
I suspect the issue lies in the unregister function within client.go. The function currently disconnects the client immediately when the server detects a disconnection, without providing any grace period to determine if the client has simply navigated to another page temporarily.
Current Implementation of unregister:
func (c*Client) unregister(normalClosurebool) {
log.Debugf("WebSocket client disconnected (normal closure=%t) from %s: %s", normalClosure, c.clientIP, c.id)
stats.ClientDisconnected()
ifc.role=="" {
return
}
// unsubscribe from pubsubpubsub.Unsubscribe(c.subscription)
c.exitExtendExpiration<-true// unregister from all sessionsifc.role==WebClient {
for_, session:=rangestore.GetClientSessions(c.id) {
log.Printf("Unregistering web client %s from session %s:%s", c.id, session.Page.Name, session.ID)
store.RemoveSessionWebClient(session.Page.ID, session.ID, c.id)
sendPageEventToSession(session, "disconnect", "")
}
}
// unregister host client from all pagesifc.role==HostClient {
for_, page:=rangec.pages {
c.unregisterPage(page)
}
}
// unregister web client from a page nameifc.role==WebClient {
forpageName:=rangec.pageNames {
store.RemovePageNameWebClient(pageName, c.id)
}
}
// expire client immediatelyifnormalClosure {
deleteExpiredClient(c.id, true)
}
}
Suggest a solution
The unregister function could be modified to introduce a delay before fully disconnecting the client. This delay would allow time to check whether the client is reconnecting or has simply navigated to another page momentarily. For instance, a timeout of one minute could prevent unnecessary disconnections and improve the user experience during authentication.
Screenshots
No response
Additional details
No response
The text was updated successfully, but these errors were encountered:
Duplicate Check
Describe the requested feature
I am trying to use authentication in my application, and it works correctly on web. However, when using a mobile device in the web, after completing the authentication process and being redirected to the authentication page, the server assumes the client has disconnected. As a result, the server immediately restarts.
This behavior causes a problem: when the authentication process finishes, the server has already disconnected the session. The client tries to reconnect, but the session has been terminated, resulting in errors.
I suspect the issue lies in the
unregister
function withinclient.go
. The function currently disconnects the client immediately when the server detects a disconnection, without providing any grace period to determine if the client has simply navigated to another page temporarily.Current Implementation of
unregister
:Suggest a solution
The
unregister
function could be modified to introduce a delay before fully disconnecting the client. This delay would allow time to check whether the client is reconnecting or has simply navigated to another page momentarily. For instance, a timeout of one minute could prevent unnecessary disconnections and improve the user experience during authentication.Screenshots
No response
Additional details
No response
The text was updated successfully, but these errors were encountered: