jdev - 2022-09-25


  1. JiraTaskDodger

    Hi everyone,

  2. JiraTaskDodger

    I am an android developer, my team uses Smack for the chat functionality of the app, I was assigned to solve 'Last Seen/Online/Offline' feature and I have almost finished the task except one thing, when the opposite side's access to internet gets interrupted I only get notified after 5 minutes if i am not mistaken and during 5 minutes it shows that the opposite side is still online, I have few solutions in my mind but I don't find neither of them effective not the best use case, I wonder how would you solve it? I have tried PingManager, like pingManager.pingMyServer() and set the pingInterval to the desired seconds but it does not work and on PingFailedListener does not get invoked, furthermore I am not even sure this is right solution. Thank you beforehand

  3. JiraTaskDodger

    I am an android developer, my team uses Smack for the chat functionality of the app, I was assigned to solve 'Last Seen/Online/Offline' feature and I have almost finished the task except one thing, when the opposite side's access to internet gets interrupted I only get notified after 5 minutes if i am not mistaken and during 5 minutes it shows that the opposite side is still online, I have few solutions in my mind but I don't find neither of them effective not the best use case, I wonder how would you solve it? I have tried PingManager, like pingManager.pingMyServer() and set the pingInterval to the desired seconds but it does not work and PingFailedListener does not get invoked, furthermore I am not even sure this is the right solution. Thank you beforehand

  4. JiraTaskDodger

    Hi everyone

  5. JiraTaskDodger

    I am an android developer, my team uses Smack for the chat functionality of the app, I was assigned to solve 'Last Seen/Online/Offline' feature and I have almost finished the task except one thing, when the opposite side's access to internet gets interrupted I only get notified after 5 minutes if i am not mistaken and during 5 minutes it shows that the opposite side is still online, I have few solutions in my mind but I don't find them either effective or the best use case, I wonder how would you solve it? I have tried PingManager, like pingManager.pingMyServer() and set the pingInterval to the desired seconds but it does not work and PingFailedListener does not get invoked, furthermore I am not even sure this is the right solution. Thank you beforehand

  6. MattJ

    JiraTaskDodger: my opinion is that modern clients should not base any "last activity" on presence status

  7. MattJ

    It is completely useless information due to mobile devices and the prevalence of mobile internet connections. Online does not mean "the user is active" (it could be in their pocket) and offline does not mean "the user is not reachable" (due to push notifications)

  8. MattJ

    Aggressively pinging clients to determine their connectivity status more accurately will just drain batteries

  9. MattJ

    And still not provide any useful information

  10. JiraTaskDodger

    This is how I have done it, if there is a mistake in my implementation please do let me know... - When a user completely removes the app from background(Completely closes the app) I disconnect the user from server(I send Presence.unavailable & Mode.away, the disconnect function takes Presence argument where I define Type and Mode), I can quite easily detect this from the opposite side. - When a user does not completely closes the app(The app works in the background and it has not been removed from recent apps list) I disconnect it from server after 15 seconds (The same way when a user closes it completely) - When a user opens the app, I send Presence.available & Mode.Chat because when I do not work with Mode, it collides with the push notification feature, when a user receives a notification from someone it automatically connects to the server and sends Presence.available but this is not mean the user is free to chat to wants to be seen online, so working with Presence type is sufficient in my case, however sending Mode(chat) as well solves this issue. - Well, this is how I have addressed your second paragraph and solved the issue.(It is completely useless information due to mobile devices ...) - I am quite aware that pinging a user is not the best way, that is why I am asking the question here, I don't know how I can solve the issue(LastActivity, Presence) if the person I am talking to losses internet connection suddenly.

  11. JiraTaskDodger

    MattJ

  12. JiraTaskDodger

    This is how I have done it, if there is a mistake in my implementation please do let me know... - When a user completely removes the app from background(Completely closes the app) I disconnect the user from server(I send Presence.unavailable & Mode.away, the disconnect function takes Presence argument where I define Type and Mode), I can quite easily detect this from the opposite side. - When a user does not completely close the app(The app works in the background and it has not been removed from recent apps list) I disconnect it from server after 15 seconds (The same way when a user closes it completely) - When a user opens the app, I send Presence.available & Mode.Chat because when I do not work with Mode, it collides with the push notification feature, when a user receives a notification from someone it automatically connects to the server and sends Presence.available but this is not mean the user is free to chat to wants to be seen online, so working with Presence type is sufficient in my case, however sending Mode(chat) as well solves this issue. - Well, this is how I have addressed your second paragraph and solved the issue.(It is completely useless information due to mobile devices ...) - I am quite aware that pinging a user is not the best way, that is why I am asking the question here, I don't know how I can solve the issue(LastActivity, Presence) if the person I am talking to losses internet connection suddenly.

  13. MattJ

    If you're in control of the server, you could make it include some annotation in the presence if the user gets disconnected

  14. MattJ

    But I don't think there is much you can do about this

  15. MattJ

    In the real world there is no way to tell between a temporary and permanent disconnect, other than waiting

  16. JiraTaskDodger

    This is how I have done it, if there is a mistake in my implementation please do let me know... - When a user completely removes the app from background(Completely closes the app) I disconnect the user from server(I send Presence.unavailable & Mode.away, the disconnect function takes Presence argument where I define Type and Mode), I can quite easily detect this from the opposite side. - When a user does not completely close the app(The app works in the background and it has not been removed from recent apps list) I disconnect it from server after 15 seconds (The same way when a user closes it completely) - When a user opens the app, I send Presence.available & Mode.Chat because when I do not work with Mode, it collides with the push notification feature, when a user receives a notification from someone it automatically connects to the server and sends Presence.available but this does not mean that the user is free to chat or wants to be seen online, so working with Presence type is sufficient in my case, however sending Mode(chat) as well solves this issue. - Well, this is how I have addressed your second paragraph and solved the issue.(It is completely useless information due to mobile devices ...) - I am quite aware that pinging a user is not the best way, that is why I am asking the question here, I don't know how I can solve the issue(LastActivity, Presence) if the person I am talking to losses internet connection suddenly.

  17. JiraTaskDodger

    The unfortunate thing is no one in the team knows a thing about Erlang or has enough knowledge on Ejabberd/XMPP. We research while we develop... Thank you for your response anyways

  18. MattJ

    Well, at the very lowest level of the stack there is no notification for when a device loses radio or wifi signal. So you are always going to have to deal with "ghost" sessions that take a while to timeout. Some of the timeouts are easy to configure, some are harder. But either way there is no accurate way to instantly detect when someone is no longer connected. So you need to deal with that.