Book Image

Practical XMPP

By : Steven Watkin, David Koelle
Book Image

Practical XMPP

By: Steven Watkin, David Koelle

Overview of this book

XMPP (eXtensible Messaging and Presence Protocol) is a messaging protocol that enables communication between two or more devices via the Internet. With this book, developers will learn about the fundamentals of XMPP, be able to work with the core functionality both server-side and in the browser, as well as starting to explore several of the protocol extensions. You will not only have a solid grasp of XMPP and how it works, but will also be able to use the protocol to build real-world applications that utilize the power of XMPP. By the end of this book, you will know more about networking applications in general, and have a good understanding of how to extend XMPP, as well as using it in sample applications.
Table of Contents (16 chapters)
Practical XMPP
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
An Introduction to XMPP and Installing Our First Server

Building the client


When building the client, there are three files we'll be editing; let's quickly list these to make referencing them later much easier:

  • views/index.ejs: The HTML that will be delivered by our server to the browser. It loads the page structure, the JavaScript, and the required CSS. We'll refer to this as the HTML file.
  • public/css/style.css: The style file where we'll put all our CSS declarations, the style (or CSS) file.
  • public/scripts/xmpp.js: The file where we'll put all our JavaScript for the client, our JavaScript file.

We'll build these files slowly so that each part is understood as we go along.

Connecting anonymously

The first thing we should do is remove all the unnecessary functions within our JavaScript file, so delete the following functions:

  • handleItems
  • getNodeItems
  • discoverBuddycloudServer

The great thing is that the skeleton project already has an anonymous login setup in place for us, so we can just edit it to match our requirements. The login function should look...