HTML and CSS Reference
In-Depth Information
// Indicate that this handler should be called repeatedly
return true;
}
We also need to associate this handler with the connection after connecting, as
shown in Listing 4-12.
Listing 4-12. Associating the addHandler with the Connection
connection.addHandler(messageHandler, null, "message", "chat");
Now, try sending a message from one of your chat clients, like Pidgin, to the web
user. The message handler function should be called with a message stanza. Figure 4-10
illustrates a chat message exchange.
Figure 4-10. Chatting between Pidgin and chat.html
To send a message back to the web user, you need to send a message stanza to the
server. This message stanza must have a type attribute of "chat" and a body element
containing the actual chat text, as shown in Listing 4-13.
 
Search WWH ::




Custom Search