ebook img

XMPP: The Definitive Guide: Building Real-Time Applications with Jabber Technologies PDF

307 Pages·2009·15.428 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview XMPP: The Definitive Guide: Building Real-Time Applications with Jabber Technologies

XMPP: The Definitive Guide XMPP: The Definitive Guide Building Real-Time Applications with Jabber Technologies Peter Saint-Andre, Kevin Smith, and Remko Tronçon Beijing • Cambridge • Farnham • Köln • Sebastopol • Taipei • Tokyo XMPP: The Definitive Guide by Peter Saint-Andre, Kevin Smith, and Remko Tronçon Copyright © 2009 Peter Saint-Andre, Kevin Smith, Remko Tronçon. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://safari.oreilly.com). For more information, contact our corporate/ institutional sales department: (800) 998-9938 or [email protected]. Editor: Mary E. Treseler Indexer: Joe Wizda Production Editor: Loranah Dimant Cover Designer: Karen Montgomery Copyeditor: Genevieve d’Entremont Interior Designer: David Futato Proofreader: Loranah Dimant Illustrator: Robert Romano Printing History: April 2009: First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. XMPP: The Definitive Guide, the image of a kanchil mouse deer on the cover, and related trade dress are trademarks of O’Reilly Media, Inc. JABBER® is a registered trademark licensed through the XMPP Standards Foundation. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information con- tained herein. ISBN: 978-0-596-52126-4 [M] 1243450993 Table of Contents Preface ..................................................................... xi Part I. An Overview of XMPP 1. Introduction ........................................................... 3 What Can You Do with XMPP? 3 Services 3 Applications 5 Brief History 7 Open Source and Open Standards 8 Extensibility 9 Summary 9 2. Basics of XMPP ........................................................ 11 Architecture 11 Addresses 14 Domains 15 Users 15 Resources 15 Internationalization 16 XMPP URIs 16 Streaming XML 16 Communication Primitives 18 Message 18 Presence 19 IQ 20 Extensibility 23 Asynchronicity 24 Error Handling 24 Hello Hello World World: Building a Basic XMPP Application 25 Summary 27 v Part II. The XMPP Toolkit 3. Presence ............................................................. 31 Is Anybody Home? 31 Authorization Required: The Subscription Handshake 31 How Presence Is Propagated 33 Availability Status 35 Presence Priorities 36 Directed Presence 37 Going Offline 37 Rich Presence 38 Presence and Rosters 39 Using Presence 42 Presence-Based Routing 42 Access Control 43 Presence As a Transport 43 Summary 44 4. Instant Messaging ..................................................... 45 I Think, Therefore IM 45 Chat Sessions 47 Are You There? Chat State Notifications 48 Looks Matter: Formatted Messages 52 Who Are You? vCards 53 Talk to the Hand: Blocking and Filtering Communication 55 Blocking: The Simple Approach 55 Advanced Blocking and Filtering 57 More Messaging Extensions 58 Summary 58 5. Discovering the World .................................................. 59 Items and Info 59 Using Service Discovery with Servers and Services 61 Using Service Discovery with Clients 64 Explicit Service Discovery 64 Entity Capabilities: Service Discovery Shorthand 66 Summary 68 6. Data Forms ........................................................... 69 Basic Structure 69 Using Data Forms 71 Defining Your Terms: Form Types 73 vi | Table of Contents Including Media in Data Forms 74 Summary 75 7. Multi-Party Interactions ................................................ 77 Starting the Party 77 Groupchat Basics 78 Crowd Control 81 What’s in a Nick? 85 Configure This! 87 Privacy, Security, and All That Jazz 91 MUC As a Data Transport 92 Summary 93 8. Publish/Subscribe ...................................................... 95 Why It Matters 95 Quickstart 97 Subscriptions 98 Publishing and Receiving Notifications 100 Payloads: To Send or Not to Send? 102 Items: To Store or Not to Store? 103 Discovering Nodes 104 Node Management 107 Creating and Deleting Nodes 107 Node Configuration 108 Managing Node Access 112 Item Aggregation via Collection Nodes 114 Personal Eventing: PubSub Simplified 117 Summary 122 9. Jingle: Jabber Does Multimedia ......................................... 123 To Instant Messaging and Beyond 123 The Jingle Model 124 Making a Call 127 A Swarm of NATs 131 Jingle on ICE 132 Additional Jingle Actions 135 Summary 136 10. Sending Binary Data ................................................... 137 Starting Small: Bits of Binary 137 Moving On Up: Transferring Midsize Files In-Band 139 Thinking Big: Sending Large Files Out-of-Band 142 Sending Data Directly 142 Table of Contents | vii Sending Data Through a Proxy 143 Negotiating File Transfer 145 File Transfer Using Stream Initiation 146 Session Negotiation Using Jingle 149 Summary 152 11. Remote Commands ................................................... 153 Controlling Clients 153 A Simple Command 154 Commands and Data Forms 156 Providing Custom Commands 160 Advanced Workflows: SOAP, RPC, IO Data 163 Summary 163 12. Connection Methods and Security ....................................... 165 Negotiating an XMPP Stream 165 Authentication Options 171 Encrypting the Connection 172 Server Federation 174 Server Components 179 BOSH: XMPP over HTTP 180 Serverless Messaging 189 XMPP Security 192 Encryption 193 Authentication and Identity 194 Spam and Abuse 195 Summary 196 Part III. Putting It All Together 13. Design Decisions ...................................................... 199 Is XMPP the Right Choice? 199 How the XMPP Community Works 201 Writing XMPP Software 202 Mixing, Matching, and Extending Existing XMPP Software 202 Client Extension, Bot, Component, or Server Module? 203 Rolling Your Own Client or Server 205 Extending XMPP 207 How to Design Custom Extensions 207 Standardizing New Extensions 209 Summary 210 viii | Table of Contents 14. Building an XMPP Application ........................................... 211 The CheshiR Microblogging Platform 211 First Sprint: The CheshiR XMPP IM Bot 211 Analysis 211 Design 212 Coding 214 Second Sprint: Configuring the CheshiR XMPP IM Bot 216 Analysis 216 Design 216 Coding 217 Third Sprint: Scaling the CheshiR XMPP Service Using a Server Component 218 Analysis 218 Design 219 Coding 220 Fourth Sprint: Registering with the CheshiR Server Component 221 Analysis 221 Design 222 Coding 222 Fifth Sprint: Extending the Server Component with Rosters 224 Analysis 224 Design 224 Coding 224 Future Sprints 227 A CheshiR Server Module or Dedicated Server? 227 Summary 228 Part IV. Appendixes A. A Guide to XMPP Specifications .......................................... 231 B. Popular Servers, Clients, and Libraries .................................... 253 C. Further Practical Considerations ......................................... 263 Glossary ................................................................... 269 Bibliography ............................................................... 273 Index ..................................................................... 277 Table of Contents | ix

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.