The newsagent script as a component
Until now, the examples we’ve used, such as cvsmsg, HostAlive, and keyassist (shown in Chapter 8), have all existed as Jabber clients. That is, they’ve performed a service while connected to the Jabber server via the JSM. There’s nothing wrong with this. Indeed, it’s more than just fine to build Jabber-based mechanisms using a Jabber client stub connection; that way, your script, through its identity—the user JID—can avail itself of all the IM-related functions that the JSM offers—presence, storage and forwarding of messages, and so on. Perhaps even more interesting is that the mechanism needs only an account, a username, and a password on a Jabber server to be part of the big connected picture.
However, we know from Chapter 4 that there are other entities that connect to Jabber to provide services. These entities are called components. You can look at components as philosophically less “transient” than their client-connected brethren and also closer to the Jabber server in terms of function and connection.
We know from Section 4.1.1 that there are various ways to connect a component: library load, STDIO, and TCP sockets. The first two dictate that the component will be located on the same host as the jabberd backbone to which it connects, although a Jabber server could consist of a collection of jabberds running on separate hosts. The TCP sockets connection type uses a socket connection between the component and the jabberd backbone, over ...
Get Programming Jabber now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.