HTML and CSS Reference
In-Depth Information
Listing 4-8. Button Event to Send the Update
var statusButton = document.createElement("button");
statusButton.onclick = function() {
var pres = $pres()
.c("show").t("away").up()
.c("status").t(statusInput.value);
connection.send(pres)
}
presenceArea.appendChild(statusButton);
Figure 4-8. Updating presence status from the browser. The most recent WebSocket message
sent by the client contains a presence stanza.message by client
To see other users' presence updates in our web application, we need to understand
incoming presence stanzas. In this simplified example, these presence updates will just
be logged as text. Listing 4-9 shows how to do this in chat_app.js . In a full-fledged chat
application, the presence updates are usually updated next to the chat conversation.
 
Search WWH ::




Custom Search