[jdev] web presence
Trejkaz
trejkaz at trypticon.org
Mon Mar 13 15:00:06 CST 2006
On Tuesday 14 March 2006 02:49, Peter Millard wrote:
> This is exactly how I would implement this as well.
>
> 1) Have an external component that uses iq:register protocol with
> x-data for picking themes, etc. This component subscribes to the
> user's presence during registration (just like a transport does). Now
> the component has the users presence.
>
> 2) External component pushes presence info into a database (mysql, psql,
> etc).
>
> 3) Write a quick PHP applet or something which returns an image based
> on the JID.
>
> We could easily deploy something like this on jabber.org provided the
> DB is psql, and the component is not in Java or Perl (for scalability
> issues). Seems like this would be super easy to write using the
> Twisted Python jabber component stuff.
>
> This approach would also work with any server implementation since the
> component is subscribing to the user's presence.
I've implemented something much like this recently (past week, in fact, and
still going) with a few minor differences.
1. External component uses pure subscription to add users. That is, you add
it to your roster and it Just Works (so it can work with clients that don't
have a Service Discovery dialog.)
2. External component holds presence in-memory and exposes a DRuby interface.
3. Webapp asks the DRuby interface for the presence of a given user, and gets
it directly.
I could probably transition to an SQL database if keeping the presences
in-memory ever becomes a problem, but right now this is a pretty snappy way
to find the presence of a user.
The only differences with doing this as a component instead of a client bot:
1. Components don't have a roster, so to send the presence of the component
itself you have to send an individual presence packet to every subscribed
user on startup, and when new users join.
2. The server doesn't send you the presence flood on login, so you have to
send individual presence probes to every subscribed user on startup too,
to prod the server into telling you their status.
3. Some clients which sort agents into a different group will nicely put the
Web Presence component in the group with other transports.
TX
--
Email: trejkaz at trypticon.org
Jabber ID: trejkaz at trypticon.org
Web site: http://trypticon.org/
GPG Fingerprint: 9EEB 97D7 8F7B 7977 F39F A62C B8C7 BC8B 037E EA73
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <https://www.jabber.org/jdev/attachments/20060314/f628cef5/attachment-0002.pgp>
More information about the JDev
mailing list