Professional XMPP Programming with JavaScript and jQuery 1st Edition Jack Moffitt all chapter instant download
Professional XMPP Programming with JavaScript and jQuery 1st Edition Jack Moffitt all chapter instant download
com
https://ebookname.com/product/professional-xmpp-programming-
with-javascript-and-jquery-1st-edition-jack-moffitt/
OR CLICK HERE
DOWLOAD NOW
https://ebookname.com/product/beginning-javascript-and-css-
development-with-jquery-1st-edition-york/
ebookname.com
https://ebookname.com/product/drupal-6-javascript-and-jquery-1st-
edition-matt-butcher/
ebookname.com
https://ebookname.com/product/beginning-jquery-1st-edition-jack-
franklin-auth/
ebookname.com
https://ebookname.com/product/the-jesuits-and-the-monarchy-catholic-
reform-and-political-authority-in-france-1590-1615-eric-nelson/
ebookname.com
Cognitive English Grammar Cognitive Linguistics in
Practice 2nd Edition Gunter Radden
https://ebookname.com/product/cognitive-english-grammar-cognitive-
linguistics-in-practice-2nd-edition-gunter-radden/
ebookname.com
https://ebookname.com/product/the-cinema-of-mia-hansen-love-candour-
and-vulnerability-1st-edition-kate-ince/
ebookname.com
https://ebookname.com/product/patent-copyright-trademark-an-
intellectual-property-desk-reference-7th-edition-stephen-elias/
ebookname.com
https://ebookname.com/product/multicultural-psychology-6th-edition-
jeffery-scott-mio/
ebookname.com
https://ebookname.com/product/fish-diseases-and-disorders-
volume-1-protozoan-and-metazoan-infections-second-edition-p-t-k-woo/
ebookname.com
MonoGame Succinctly 2018-05-30 Edition Jim Perry
https://ebookname.com/product/monogame-succinctly-2018-05-30-edition-
jim-perry/
ebookname.com
Professional
Jack Moffitt
ISBN: 978-0-470-54071-8
10 9 8 7 6 5 4 3 2 1
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,
electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108
of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization
through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers,
MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the
Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201)
748-6008, or online at http://www.wiley.com/go/permissions.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with
respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including
without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or pro-
motional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold
with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services.
If professional assistance is required, the services of a competent professional person should be sought. Neither the pub-
lisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to
in this work as a citation and/or a potential source of further information does not mean that the author or the publisher
endorses the information the organization or Web site may provide or recommendations it may make. Further, readers
should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was
written and when it is read.
For general information on our other products and services please contact our Customer Care Department within the
United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available
in electronic books.
Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress are
trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other coun-
tries, and may not be used without written permission. JavaScript is a registered trademark of Sun Microsystems, Inc. All
other trademarks are the property of their respective owners. Wiley Publishing, Inc. is not associated with any product or
vendor mentioned in this book.
Introduction xIx
What Is XMPP? 4
A Brief History of XMPP 5
The XMPP Network 6
Servers 6
Clients 7
Components 7
Plug-ins 8
XMPP Addressing 8
XMPP Stanzas 9
Common Attributes 10
Presence Stanzas 1 1
Message Stanzas 13
IQ Stanzas 15
Error Stanzas 17
The Connection Life Cycle 18
Connection 18
Stream Set Up 19
Authentication 20
Disconnection 20
Summary 20
Application Preview 40
Hello Design 40
Preparing the Way 41
jQuery and jQuery UI 42
Strophe 42
flXHR 43
XMPP Accounts 43
Starting Your First Application 43
User Interface 43
Application Code 45
Making Connections 47
The Connection Life Cycle 47
Creating a Connection 48
Connecting Hello 49
Running the Application 53
Creating Stanzas 53
Strophe Builders 54
Saying Hello 56
Handling Events 57
Adding and Removing Handlers 57
Stanza Matching 57
Stanza Handler Functions 58
Handling Responses in Hello 59
More Hellos 62
Summary 62
Chapter 4: Exploring the XMPP Protocol:
A Debugging Console 63
Application Preview 64
Peek Design 64
xii
Application Preview 88
Arthur Design 88
Microblogging with Identica 89
Creating Your Account 90
Turning on XMPP 90
Building Arthur 90
Getting Started 91
Receiving Messages 93
XHTML-IM 94
Adding XHTML-IM to Arthur 95
Sending Messages 96
Offline Messages 97
Creating a Better Microblogger 101
Summary 102
Chapter 6: Talking with Friends: One‑on‑One Chat 103
xiii
xiv
xv
xvi
xvii
Index 441
xviii
XMPP powers a wide range of applications including instant messaging, multi-user chat, voice
and video conferencing, collaborative spaces, real-time gaming, data synchronization, and even
search. Although XMPP started its life as an open, standardized alternative to proprietary instant
messaging systems like ICQ and AOL Instant Messenger, it has matured into an extremely robust
protocol for all kinds of exciting creations.
Facebook uses XMPP technology as part of its chat system. Google uses XMPP to power Google
Talk and its exciting new Google Wave protocol. Collecta has built a real-time search engine
based extensively on XMPP’s publish-subscribe system. Several web browsers are experimenting
with XMPP as the basis of their synchronization and sharing systems. Dozens of other companies
have XMPP-enabled their web applications to provide enhanced user experiences and real-time
interaction.
The core of XMPP is the exchange of small, structured chunks of information. Like HTTP, XMPP
is a client-server protocol, but it differs from HTTP by allowing either side to send data to the other
asynchronously. XMPP connections are long lived, and data is pushed instead of pulled.
Because of XMPP’s differences, it provides an excellent companion protocol to HTTP. XMPP-powered
web applications are to AJAX what AJAX was to the static web site; they are the next level of interactiv-
ity and dynamism. Where JavaScript and dynamic HTML have brought desktop application features to
the web browser, XMPP brings new communications possibilities to the Web.
XMPP has many common social web features built in, due to its instant messaging heritage.
Contact lists and subscriptions create social graphs, presence updates help users keep track of who
is doing what, and private messaging makes communication among users trivial. XMPP also has
nearly 300 extensions, providing a broad and useful range of tools on which to build sophisticated
applications. With only a handful of these, along with the core protocol, amazing things can be built
This book teaches you to harness the promise of XMPP in your own applications, enabling you to
build applications that are social, collaborative, real time, or all of the above. You will develop a
series of increasingly sophisticated XMPP applications, starting from “Hello, World!” and finishing
with a collaborative text editor, a shared sketch pad, and a real-time, multi-player game. By the end,
you will have all the tools you need to build the next generation of applications using XMPP or to
add new real-time, push, or social features to your current applications.
The JavaScript language is used to develop all the applications in the book because it is an easy lan-
guage to understand, is familiar to a large number of programmers, and comes on every computer
with a web browser. Even though this book uses JavaScript, all the concepts and applications could
be developed in any language; most of the “hard parts” are not related to the programming language,
the libraries used, or the web browser. You do not need to be a JavaScript expert to understand and
work with the code in this book.
It is assumed that you understand the basic front-end web technologies, CSS and HTML. If you’ve
ever written a little HTML from scratch and changed a few CSS styling properties, you should be
fine.
This book also makes use of two libraries, jQuery and Strophe. It is helpful if you have used
jQuery before, but if you haven’t, a short primer is included in Appendix A. The Strophe library is
explained fully as the applications are developed.
Although these topics are all approached from the client side, almost all of it is equally applicable to
XMPP bots or server components and plug-ins.
The book also covers XMPP programming related topics such as application design, event handling,
and combining simple protocol elements into a greater whole. Along the way, a few web programming
topics are also discussed such as the Canvas API.
XMPP is now more than 10 years old and quite mature. This book covers the 1.0 version of the core
protocol. The XMPP protocol parts of this book should work unchanged in future versions of the pro-
tocol, just as HTTP 1.0 clients can easily communicate with HTTP 1.1 servers.
XMPP has many extensions and several of these are also covered. For the most part, the book con-
centrates on extensions that are in a stable, mature state. For each extension used, the document
number is always given, and if in doubt, you can always check the latest version of the extension to
see if it has been changed or superseded.
xx
The book was written with the 1.3 series versions of jQuery and the 1.7 series versions of jQuery UI.
These libraries generally remain backward compatible to a large degree. Version 1.0 of the Strophe
library is used, but future 1.X versions should also work fine.
xxi
Chapter 12 requires some server-side assistance. The example uses the Python programming lan-
guage along with the Django framework to provide this. This chapter is an advanced topic and is
not needed for the normal applications in the book.
Conventions
To help you get the most from the text and keep track of what’s happening, we’ve used a number of
conventions throughout the book.
Boxes like this one hold important, not-to-be forgotten information that is
directly relevant to the surrounding text.
Notes, tips, hints, tricks, and asides to the current discussion are offset and
placed in italics like this.
Source Code
As you work through the examples in this book, you may choose either to type in all the code
manually or to use the source code files that accompany the book. All of the source code used in this
book is available for download at http://www.wrox.com. Once at the site, simply locate the book’s
title (either by using the Search box or by using one of the title lists) and click the Download Code
link on the book’s detail page to obtain all the source code for the book.
xxii
Because many books have similar titles, you may find it easiest to search by
ISBN; this book’s ISBN is 978-0-470-54071-8.
Once you download the code, just decompress it with your favorite compression tool. Alternatively,
you can go to the main Wrox code download page at http://www.wrox.com/dynamic/books/
download.aspx to see the code available for this book and all other Wrox books.
Errata
We make every effort to ensure that there are no errors in the text or in the code. However, no one
is perfect, and mistakes do occur. If you find an error in one of our books, like a spelling mistake
or faulty piece of code, we would be very grateful for your feedback. By sending in errata, you may
save another reader hours of frustration and at the same time you will be helping us provide even
higher quality information.
To find the errata page for this book, go to http://www.wrox.com and locate the title using the Search
box or one of the title lists. Then, on the book details page, click the Book Errata link. On this page
you can view all errata that has been submitted for this book and posted by Wrox editors. A com-
plete book list including links to each book’s errata is also available at www.wrox.com/misc-pages/
booklist.shtml.
If you don’t spot “your” error on the Book Errata page, go to www.wrox.com/contact/techsupport
.shtml and complete the form there to send us the error you have found. We’ll check the information
and, if appropriate, post a message to the book’s errata page and fix the problem in subsequent
editions of the book.
p2p.wrox.com
For author and peer discussion, join the P2P forums at p2p.wrox.com. The forums are a web-based
system for you to post messages relating to Wrox books and related technologies and interact with
other readers and technology users. The forums offer a subscription feature to e‑mail you topics
of interest of your choosing when new posts are made to the forums. Wrox authors, editors, other
industry experts, and your fellow readers are present on these forums.
At http://p2p.wrox.com you will find a number of different forums that will help you not only as
you read this book, but also as you develop your own applications. To join the forums, just follow
these steps:
1. Go to p2p.wrox.com and click the Register link.
2. Read the terms of use and click Agree.
xxiii
Fig. 178.—Seat of operation for puncturing the pericardium by way of the ensiform
cartilage. L B, White line; H, line of the hypochondrium; V. M.a., anterior
mammary vein; P, point where the pericardium is punctured through the incision.
Fig. 180.—Photograph of the same subject as Fig. 179, taken six days later.
CHRONIC PERICARDITIS.
PSEUDO-
PERICARDITIS.
PHLEBITIS.
ACCIDENTAL PHLEBITIS.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookname.com