The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

hobbeswang (6) [Avatar] Offline
#1
under what process that the user can see the roster item's status when the user login into jabber system?
thanks in advance.
hobbeswang (6) [Avatar] Offline
#2
Re: after the user get his/her roster, then what?
Hi, iain,
I want to clear my issue:
is the following steps right?
1, user A logs in, then sends his presence info to userB, is userB is not available, then the server will store the message, and then when userB logins, the server sends the presence info the userB, so userB can see not only the roster userA, but also the presence of userA, is the above statement true?

or, is there existing some mechanisom that when userA logins, the server will send back not only the userA's roster, but also each item's presence in the roster?

thanks very much!
iain (56) [Avatar] Offline
#3
Re: after the user get his/her roster, then what?
Hi

Normally presence is handled by the server. When a user logs in or changes their presence, they send the presence to the server (by implicit addresssing - leaving off the 'to' attribute). E.g. user A in your example would just send:

<presence type='available'/>

The server will automatically send copies of the presence to the appropriate people on the user's roster. When new users login and happen to be on another person's roster, the server will update those new people with presence information. Think of it as a publish-subscribe channel where the data you're publishing is the current presence of a user, and the subscribers of that information is the people on your roster.

Presence packets are not stored for later redelivery (that is a feature of <message/> packets only) so if you send a directed presence packet, it bypasses the roster, and if the recipient is offline, it is not delivered. E.g. the following would not be delivered ever if userb is offline:

<presence to="userb@server.com" type="available"/>

-iain
hobbeswang (6) [Avatar] Offline
#4
Re: after the user get his/her roster, then what?
Hi, iain,
thanks for your feedback,

what bothers me, is, when user can get the roster's presence when user logs in?

for example, there are 2 users, A and B. they subscribed each other's presence.

When A logins, he should see not only B in his roster list, but also B's presence. but if B has already logined before A, should B send her presence to A as soon as A logins? (because when B logins, A is not online, so B will not send the presence to A)(of cause, A will send his presence to B , that is clear for me now).

thanks in advance.
iain (56) [Avatar] Offline
#5
Re: after the user get his/her roster, then what?
No, the server manages the rosters and presence.

The server tracks the last presence for each user sent to the server, and when a new user logs in, updates that user with the last presence for each user on the new user's roster. You can bypass this by addressing your presence to a user directly (so the server basically ignores that presence as far as roster tracking goes). However, normally this is handled by the server. This makes the server much harder to write because it must record, track, and broadcast the right presence at the right times, but makes the client much easier to write.

-iain
hobbeswang (6) [Avatar] Offline
#6
Re: after the user get his/her roster, then what?
Hi iain,
thanks fro your reply.
would you please tell me how to say a roster is "offline"?
does that mean the roster's presence is unavailable?

thanks.
iain (56) [Avatar] Offline
#7
Re: after the user get his/her roster, then what?
Hi,

Rosters are never offline. They are stored on the server, managed by the server, and respond to presence sent to the server. If you want your roster members to think you are offline when you are actually online, you can use the "invisible" presence which is supported on some servers.

-iain