Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Practical XMPP

You're reading from   Practical XMPP Unleash the power of XMPP in order to build exciting, realtime, federated applications based on open standards in a secure and highly scalable fashion

Arrow left icon
Product type Paperback
Published in Sep 2016
Publisher Packt
ISBN-13 9781785287985
Length 250 pages
Edition 1st Edition
Arrow right icon
Authors (3):
Arrow left icon
Steven Watkin Steven Watkin
Author Profile Icon Steven Watkin
Steven Watkin
David Koelle David Koelle
Author Profile Icon David Koelle
David Koelle
Lloyd Watkin Lloyd Watkin
Author Profile Icon Lloyd Watkin
Lloyd Watkin
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. An Introduction to XMPP and Installing Our First Server FREE CHAPTER 2. Diving into the Core XMPP Concepts 3. Building a One-on-One Chat Bot - The "Hello World" of XMPP 4. Talking XMPP in the Browser Using XMPP-FTW 5. Building a Multi-User Chat Application 6. Make Your Static Website Real-Time 7. Creating an XMPP Component 8. Building a Basic XMPP-Based Pong Game 9. Enhancing XMPPong with a Server Component and Custom Messages 10. Real-World Deployment and XMPP Extensions

Data forms in XMPP-FTW


As data forms follow a set format, they are easy to map to and from JSON for use with XMPP-FTW. The only minor difference with data forms is that as we are using named events, XMPP-FTW is able to fill in the FORM_TYPE on your behalf; so it's a little simpler again.

If we take the preceding example in which we configured a chat room, we'd have the following in XMPP-FTW:

socket.send( 
  'xmpp.muc.room.config.get', 
  { "room": "gang@lous.cafe" }, 
  function(error, data) { console.log(error, data) } 
) 

The server would then respond with a data form formatted, like so:

{ 
  title: "Configuration for "gang" Room", 
  instructions: "Update this form to modify the configuration of the chat 
   room", fields: [ 
    { var: "muc#roomconfig_roomname", type: "text-single", required: false,
     value: "Biff's gang @ the diner", label: "Room Name" }, 
    { 
      var: "muc#roomconfig_maxusers", 
      type: "list...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image