HTML and CSS Reference
Figure 4-7. Logging in from chat.html and appearing online in Pidgin. Each WebSocket
message displayed in the developer tools contains an XMPP stanza
■ The $pres() function call in the connect handler is necessary to indicate that the
user has logged online. These presence updates can convey more details, as we will see in
the next section.
Presence and Status
Now that we know we can connect a user, let's take a look at tracking user presence and
status. The way the web user appeared to be online in the contact list of the desktop
user is due to the presence features of XMPP. Even when you are not chatting, presence
information is constantly pushed out from the server. You may receive presence updates
when your contacts sign online, become idle, or change their status text.