Language:EN
Pages: 403
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
were ready discuss the roster info protocol and th

Were ready discuss the roster info protocol and the user presence protocols

Instant Messaging
in Java

M A N N I N G

Greenwich

Fax: (203) 661-9018
email: orders@manning.com

©2002 by Manning Publications Co. All rights reserved.

Copyeditor: Lois Patterson

209 Bruce Park Avenue

Printed in the United States of America

1 2 3 4 5 6 7 8 9 10 - VHG 05 04 03 02

preface
about this book
author online

xxi

acknowledgments

xxii

about the cover illustration

3
4

1.2

1.3 Benefits of the Jabber protocols 27

28

1.4 Drawbacks of the Jabber protocols
1.5 Conclusion

29

Benefits 35 I Drawbacks 36

I Relying on distributed

servers 38

I How Jabber packet routing works 39

2.2 The core Jabber protocols
Message: Delivering data 45
online status 45
2.3

Jabber session example

47

2.4 Conclusions

59

Goals for our server 60

I Our server software 61

3.2 The session pool maintains client connections

3.4

3.5

XML parsing subsystem

server focal point 77

I SAX parsing in Java 80

ProcessThread 95

I The main application Server class 97

Conclusion
4 contents ix

101

4.1 Messaging is the heart of IM

102

4.2
Normal messages 104
Groupchat messages 106
Error messages 109 I Out-of-band messages 110 I Reality check:

one message, many user interfaces 112

5 4.3 Java Jabber client

113

Goals 114 I The client design 115
model 116 I Using the client model 123
4.4 Conclusions

133

5.1

The need for presence 134

5.2
5.3 Adding groupchat support
Groupchat protocols 138
6 5.4 Shortcomings of our server and basic groupchat

161

5.5 Conclusions

162

Info/Query and client registration
6.1 Info/Query: the catch-all protocol
The IQ protocol 165
6.2 Registration creates and manages accounts 169
User accounts 170
6.3 The Jabber server modifications

175

6.4

x contents Client authentication
7
7.1 Authentication controls account access

The authentication protocol 191

7.2 The Jabber server modifications

199

7.3 The Jabber client modifications

Conclusions 215

8 Roster and user presence

217

8.1 Roster protocol: presence’s missing piece
9 8.2 The Jabber server modifications
Representing user presence 224
subsystem 226

I The roster packet handlers 233

8.3

The Jabber client modifications

236
8.4 Conclusions
9.1 Creating Jabber-compliant implementations

244

Setting standards: the Jabber Software Foundation 245 Enforcing standards: Jabber Powered applications 245 Organizing standards: Jabber environments 246
Today’s options for achieving server compliance 247

9.2
Server-to-server communications: federating Jabber domains 248

integrating with other IM systems 257

I Deployment of Jabber servers

and components 260

services 262 I Jabber server management 264 I Adding reliability
9.3 Client missing pieces
9.4 User agent clients
contents xi

Enhancing existing applications 268

I Chatbots:

9.5

273

Enterprise Jabber

271

10.1
Enhancing Jabber security 273 I Guaranteed quality
of service 278 I Creating system administration tools

10.4

The promise of MOM

280

Examples of Jabber applications

292

Jabber groupware 292

services 293
Distributed application alternatives to Jabbers

I P2P systems:

the new challenger 298

references 369

index 373

xiii

xiv

Then I came across Jabber. It is open source, and exploits the very best fea-tures of XML, another hot technology. I was familiar with XML and understood the fundamental benefits driving its hype but had yet to see a compelling reason to use XML in my software. Jabber appeared to be that application.

Digging deeper into Jabber revealed a design that was simple and flexible. I’m a firm believer in the KISS philosophy2 so the appeal only grew. I decided to start playing with the technology.

about this book

This book leads the reader in building an IM system using the Java programming language. I believe that the best way of showing how something like instant mes-saging is done in general is to illustrate how it is done with a particular example. Our IM system uses the Jabber protocols and architecture and we’ll cover both in depth as we build our software. Once you understand how the Jabber protocols work to create an IM system, I hope that you will be able to extrapolate your expe-rience to build other IM systems based on Jabber or other protocols if necessary.

xv

xvi

about this book

This book is split into three parts. Part 1 introduces IM and Jabber technologies and describes the basic architecture of all Jabber-based systems. In part 2, we dig into the gritty details of the core Jabber protocols and develop Java server and cli-ent software. Finally, in appendix A, I’ve included a condensed reference to the Jabber protocols as they stand at the time of this writing. The Jabber protocols are continuing to evolve so you should check the Jabber website (www.jabber.org) for announcements and the book’s website (www.manning.com/shigeoka) for updated versions of the reference section.

Part 1—Overview

about this book xvii

A technical overview of the Jabber

architecture and protocols. We also examine the raw communication stream between the Jabber server and client to illustrate what “raw” Jabber looks like.

Chapter 4—The Jabber message protocols. Covers the Jabber message protocol and implements support for basic messaging in the server. In addition, we develop a “test Jabber client” to test our evolving Jabber server.

Covers the Jabber presence protocols and Chapter 5—The presence protocols.

Chapter 8—Roster and user presence. With user accounts firmly established in chapters 6 and 7, we’re ready to discuss the roster info/query protocol and the user presence protocols. A user’s roster stores the “buddy list” of subscribers inter-ested in their presence status. The user presence protocols update the user’s pres-ence and subscribe users to other users’ rosters.

Chapter 9—Creating a complete Jabber system. Ties up the loose ends for part 2. There is no way to complete a fully featured or “production ready” server or client within the book. This chapter describes what remains to be done and suggests ways to tackle each problem.

xviii

How to use this book

I would suggest that you read chapters 1–3 in order to get a firm grasp of Jabber and the software that we build throughout the book. Chapters 4–8 build upon each other. If you are completely unfamiliar with the Jabber protocols it may be a good idea to read through them in the order presented. If you only want to learn the protocols, you can read the first section of each of those chapters as source code is presented at the end of the chapter.

I Technical terms are introduced in italic font.

I Code examples and fragments appear in a fixed-width font.

about this book xix

I Many sections of code have annotations which appear in the right margin.

I Some advanced topics are discussed that will not be of interest to beginning programmers. These advanced discussions have a gray background and a black diamond in the margin. Beginners can skip these sections.

Tools: a Java development environment

Building the Java software covered in this book requires four tools. I’ve tried to keep the requirements to a minimum. The following table shows you what tools

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : Vritika Divan

PageId: DOC802B517