Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
wmorrison #1
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile
Subject: Last Event after Login
Hello,
       Is OnPresence the last event to fire after login on?  It not which event is the last event to fire? If it is, when would one know when the last presence was sent?

Regards,
Will
Avatar
Alex #2
Member since Feb 2003 · 4298 posts · Location: Germany
Group memberships: Administrators, Members
Show profile
Sending your own presence to the server is the last step in the login process.
This results in getting you own presence back from the server and all online presences of you subscribed contacts.
There is no way to know when you received the last presence. The come in continuous as the change in real-time.

Alex
Avatar
wmorrison #3
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile
This is not good.  I need to know when the last OnPresence gets sent after a successful login.
Avatar
Alex #4
Member since Feb 2003 · 4298 posts · Location: Germany
Group memberships: Administrators, Members
Show profile
This is how XMPP is designed.
Every presence package looks the same, doesn't matter if its an initial presence during login, or a presence change of a user after login.
Avatar
wmorrison #5
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile
Hi Alex,
         This I know and have to accept.  So I need to be creative with events to know when the last presence is sent just after login on.  Also when messages are sent is there a "delivery receipt" event?

Regards,
Will
Avatar
Alex #6
Member since Feb 2003 · 4298 posts · Location: Germany
Group memberships: Administrators, Members
Show profile
You can request a delivery receipt. You can find many threads about this here.

If you let us know why you would need the last presence we maybe able to suggest a solution to you. What is the business case for this?

Alex
Avatar
wmorrison #7
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile
Hi Alex,
   This is the what I am trying to do.  When the user login, I would like to update the database of contacts all the contacts that on currently online.  Therefore I would need to gather all the presence broadcast and store to the database.  Once that is done I can update the UI with the new data.

Regards,
Will
Avatar
Alex #8
Member since Feb 2003 · 4298 posts · Location: Germany
Group memberships: Administrators, Members
Show profile
XMPP is designed to do this in realtime. You login in, receive your contacts, send your initial presence and then get automatically the presence from your contacts. consider contacts as offline in your UI by default and update the UI as you get an OnPresence event.

Alex
Avatar
wmorrison #9
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile
Hi Alex,
        I plan to update the UI when a onpresence is fired realtime.  What I don't want to do is to hold up the UI thread updating a long list of onpresence when the user login for the first time.  This could be a blocking effect to the user.

Regards,
Will
Avatar
Alex #10
Member since Feb 2003 · 4298 posts · Location: Germany
Group memberships: Administrators, Members
Show profile
MatriX runs in its own threads. It's pretty easy to write code which does not block your UI thread.
We have never seen any problems with this is many years.

Alex
Avatar
wmorrison #11
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile
Hi Alex,
         I am really doing a poor job of explaining myself.  For immediate update to the user, I have to be on the UI thread.  So on logon and getting all 200 onpresence triggers back to back would hold the UI thread.  Right now I have it running another thread but I don't know when the final onpresence get fired.  If I did, I would update the interface (listview) on the UI thread after the final onpresence.  All subsequent onpresence would be handle by the UI thread. 

Regards,
Will
Avatar
Alex #12
Member since Feb 2003 · 4298 posts · Location: Germany
Group memberships: Administrators, Members
Show profile
200 presences are no problem at all, especially when you do them in background threads.
If you don't want to do that then you have to find your own way to detect the last presence. You can have a timer for example during login which queues up the presences and does a batch UI update.

Alex
Avatar
wmorrison #13
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile
Hi Alex,
       This is exactly what I have designed.  I was hoping for a better solution.  Thank

Regards,
Will
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: MatriX RSS