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.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by pushp]


Iain

Early on in your book you mention the "probe" presence protocol will be
discussed in Chap 8, but I couldnt find it there.

What is in general the best way for an external application to discover the
presence status of the entire membership of a jabber server ?

Is it possible to do it with a client API ?

Should the application act as a server in the cluster and use the probe
protocol ?

Are there implementation specific details or hints on how changing presence
attributes can be pushed out to listeners/applications external to the jabber
server ?
import-bot (20211) [Avatar] Offline
#2
Re: Presence Protocol/Probe
[Originally posted by iain.shigeoka]

> What is in general the best way for an external application to discover the
> presence status of the entire membership of a jabber server ?

There is no consistent, standard way of doing it. First, it's not possible to
know what all the users are on a server. You can use the JUD (Jabber user
directory) or iq:browse if they're supported on the server, but it's not
guaranteed to return all users on the system.

Second, probe only works server-2-server. So you'll have to act as a server
domain in order to do what you want to do.

Third, presence of users is only sent to approved roster subscribers. So you
can't ask for the presence of a user until you negotiate a roster subscription
to each user that you want to know the presence of.

These are security/privacy protections for end users so that other people
can't 'stalk' them online.

> Is it possible to do it with a client API ?

Sure. You can subscribe to the roster of all users on a server. The users will
have to approve your subscription request. Probably not what you had in mind
though.

> Should the application act as a server in the cluster and use the probe
> protocol ?

It can, but that won't overcome the need to know the usernames of all the
users, and to have them approve your subscription to their presence.

> Are there implementation specific details or hints on how changing presence
> attributes can be pushed out to listeners/applications external to the jabber
> server ?

Nope. Just subscribe to their roster and the server will ensure that presence
updates are sent to you.

If you could explain what you're trying to do I might be able to suggest some
approach that may do what you want.

-iain
import-bot (20211) [Avatar] Offline
#3
Re: Presence Protocol/Probe
[Originally posted by pushp]

Fair enough.

I should have said that (1) list of users is known from access to an
enterprise LDAP database (potentially the jabber server is using the same LDAP
for authentication) and (2) Without debating the privacy merits, in the
enterprise context there is a need to know the presence attributes of all the
people --so the privacy policy is waived from the point of view of this
application.

The short term need for the application we are looking at is a intelligent
message routing system of which Jabber presence is only criteria for deciding
if a message should be sent to a user on their jabber client. So this message
routing system needs to know what state a jabber user is in. A local cache of
this information is most useful.

As you note, adding the entire company to the roster of an application is
probably not the elegant way to do it, although it would work.

The longer term goal is to get presence information pushed into an aggregated
Presence Server which is aggregating presence information from various sources
of presence and Availability (of which Jabber IM would only be one source)

If the presence handler inside jabber servers would somehow be able to export
this information to an external source, the external source over time would
just be able to discover and build up a database of all online users. Although
I cant find a reference to it, I understand that there is a "blind copy"
implementation that does this using UDP ?



> > What is in general the best way for an external application to discover the
> > presence status of the entire membership of a jabber server ?
>
> There is no consistent, standard way of doing it. First, it's not possible to
> know what all the users are on a server. You can use the JUD (Jabber user
> directory) or iq:browse if they're supported on the server, but it's not
> guaranteed to return all users on the system.
>
> Second, probe only works server-2-server. So you'll have to act as a server
> domain in order to do what you want to do.
>
> Third, presence of users is only sent to approved roster subscribers. So you
> can't ask for the presence of a user until you negotiate a roster subscription
> to each user that you want to know the presence of.
>
> These are security/privacy protections for end users so that other people
> can't 'stalk' them online.
>
> > Is it possible to do it with a client API ?
>
> Sure. You can subscribe to the roster of all users on a server. The users will
> have to approve your subscription request. Probably not what you had in mind
> though.
>
> > Should the application act as a server in the cluster and use the probe
> > protocol ?
>
> It can, but that won't overcome the need to know the usernames of all the
> users, and to have them approve your subscription to their presence.
>
> > Are there implementation specific details or hints on how changing presence
> > attributes can be pushed out to listeners/applications external to the
jabber
> > server ?
>
> Nope. Just subscribe to their roster and the server will ensure that presence
> updates are sent to you.
>
> If you could explain what you're trying to do I might be able to suggest some
> approach that may do what you want.
>
> -iain
import-bot (20211) [Avatar] Offline
#4
Re: Presence Protocol/Probe
[Originally posted by iain.shigeoka]

> Fair enough.
>
> I should have said that (1) list of users is known from access to an
> enterprise LDAP database (potentially the jabber server is using the same LDAP
> for authentication) and (2) Without debating the privacy merits, in the
> enterprise context there is a need to know the presence attributes of all the
> people --so the privacy policy is waived from the point of view of this
> application.

OK. So you have access (and presumably authority) to act as the server. This
is a different scenario from trying to do it as a user/client. Especialy if
you are capable of modifying the server itself.

> The short term need for the application we are looking at is a intelligent
> message routing system of which Jabber presence is only criteria for deciding
> if a message should be sent to a user on their jabber client. So this message
> routing system needs to know what state a jabber user is in. A local cache of
> this information is most useful.

Ah. I see. Yes, this is pretty easy to do if you can modify the server. I
believe you can do this with Jabberd using a JSM module. The O'Reilly Jabber
book has a lot of coverage of how to do that using Perl and C.

My company, Jive Software (http://www.jivesoftware.com) has a Java XMPP/Jabber
server with similar plug-in capabilities called Messenger. Our server is in
beta and should be released soon. The one caveat of Jive Messenger is
server-to-server support is not slated for delivery until later this summer.
However if you only need your employees chatting with each other (one domain)
and can afford commercial software, our solution allows you to stay in Java,
plugs into LDAP for authentication of desired (uses JDBC normally), and can be
easily configured to do what you want. Sorry for the mini-commercial but I
thought you might be interested in the Java alternatives. You can contact me
directly if you want to know more.

There is the JJ server based on the book source code at www.jabberstudio.org
however the project has been dormant while I have worked at Jive. A student
has been working on the source recently and there may be progress on that
project soon but nothing you could use for probably several months. There are
several other open source Java server projects but I'm not aware of any that
are out of the design phase yet.

> As you note, adding the entire company to the roster of an application is
> probably not the elegant way to do it, although it would work.

Yes. Depending on the company size this may be a practical solution. You can
create a chatbot to do this (for Java, check out Smack at
http://www.jivesoftware.com/xmpp/smack an open source Java client library).
Then just have the chatbot log in to the server. Your users can mutually
subscribe to the chatbot's roster and the chatbot can then be automatically
notified about the user's presence and react appropriately. We know of several
people using Smack in a servlet container doing this. It does rely on your
users to actively subscribe to the chatbot's roster but you can often automate
this if you have control of the client they use (just write a bit of code to
automatically do the subscription when it register their account).

> The longer term goal is to get presence information pushed into an aggregated
> Presence Server which is aggregating presence information from various sources
> of presence and Availability (of which Jabber IM would only be one source)

Sounds like a great idea. I think a modified server is really what you want in
this scenario. It will give you a lot more control over what's going on.

> If the presence handler inside jabber servers would somehow be able to export
> this information to an external source, the external source over time would
> just be able to discover and build up a database of all online users. Although
> I cant find a reference to it, I understand that there is a "blind copy"
> implementation that does this using UDP ?

This is very server dependent so there is no generic solution. I think you'll
need to modify an existing Jabber server to accomplish this. I'd recommend
shopping around to find a server that looks promising and find out how you
modify the server (do you get source, can you create and install plug-ins of
some sort, etc). You should also take into consideration what type of usage
you're interested in. Servers tend to be designed (and priced) differently
depending on whether you're looking at a large consumer deployment, an
enterprise deployment, a small business deployment, work group deployment, or
critical messaging deployment (think JMS).

There are no optimal one-size-fits all solutions that I know of available
today. And of course, you have the book and the source so depending on your
needs, it may be possible to build a custom server yourself. smilie However, I'd
recommend starting with an existing server as a base for creating a solution
or it could take a long time.

Hope this helps

-iain