-
-
Notifications
You must be signed in to change notification settings - Fork 649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
last message/last ping in /clients #400
Comments
Yeah, seems like a good addition. I'd be in favor of a last connection used field for both applications and devices. |
I just wanted to post new issue on that, but I see that idea is not new :) I'd love to have a chance to get sort of heartbeat feature, I'd like to check from time to time if my cron isn't dead. |
hi @schoerg @jmattheis @patbel-pwr is this feature still relevant? I would like to implement this feature. Would you guys mind? |
@rafimuhammad01 yeah it is still relevant, feel free to tackle this issue. |
@jmattheis My first approach is to create new column on I think it will be better if we have another field called Do you have any concern for this approach? |
We could do this, but the connections are normally long-running meaning they could be active for a long time, additionally, it is possible to have multiple connections that use the same client token, so something like isConnected could be misleading. Clients should update their last connection timestamp, if the token was used for something different, like creating an application or changing their password. I propose that the last active time stamp is updated when the client token is used for authentication (here https://github.com/gotify/server/blob/master/auth/authentication.go#L61) and periodically, when the client has an active websocket connection. Every 5 minutes (or so) we could iterate over all the websocket clients in api/stream/stream.go and update the timestamp for these clients.
|
@jmattheis I think it is good idea, but does it means that the updated timestamps is not the real time that client is last connected? if so, will it be okay? With this approach of course we can get the real time by using 1 second for the period but I think it's not a good idea because it will lead to performance issue, right? I actually prefer to update the timestamp after the client is closing the connection so we will get the real time for client being disconnected. For the long running connection I think it will not be a problem since what I thinking first is just called the function when client close their connection and not running forever until they close their connection. Is there any operation that run every time client lost their connection and we can make sure that the token is unique for every client? cheers! 🍻 |
@rafimuhammad01 Ahh, I misunderstood the issue. I thought this would be a last activity/used thing like it is commonly done for users or access tokens. (hence my comment about applications in #400 (comment)) I think my "understanding" has a clear use-case: deleting clients / apps that weren't recently used. I'm not sure, if I support the need for real-time up-to-dateness, if the client has an active connection. Firstly, some clients will never open the websocket because these clients only use the http api. Secondly, if the use-case is to detect "broken" clients and then send the message over another medium, then you probably shouldn't use gotify, because it isn't build for "critical messaging". If it is only to detect broken clients that the last active timestamp with a delay up to 5 minutes should be good enough. Don't get me wrong, having the information if a client is currently connected sounds cool, but I don't really see the use-cases for this. |
Do you know of an alternative app that one could try, if one needs this? Thank you |
add last seen field to client (fixes #400)
Is your feature request related to a problem? Please describe.
If you use
gotify
to handle notifications it would be nice to know if clients are still reachable (or have the app installed, app killed). You can then fallback to another channel (email, sms ...) to not miss updates.Describe the solution you'd like
/client
already returns the list of clients, add another field likelast_message
orlast_keepalive
/lastping
to show when that client has last received a message or last responded to a ping.The text was updated successfully, but these errors were encountered: