O'Reilly logo

Practical XMPP by David Koelle, Lloyd Watkin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Talking to our bot from the browser

So now you've learned about XMPP connections and XMPP-FTW, and you have played with a JSON-based XMPP interface in a browser. Now let's build a very simple chat client to talk to the bot we wrote in Chapter 3, Building a One on One Chat Bot - The "Hello World" of XMPP.

Building a WebSocket-enabled web server in Node.js

First, let's create a new folder and initialize a new NPM project:

mkdir browser-chat && cd browser-chat
npm init

Answer the questions however you wish (you can just happily accept all the defaults if you want). Once completed, you'll have a saved package.json file that describes the project. As we install modules, we'll write their details into the file so that the installations can be repeated ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required