O'Reilly logo

Professional XMPP Programming with JavaScript® and jQuery by Jack Moffitt

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

Chapter 12. Getting Attached: Bootstrapping BOSH

WHAT'S IN THIS CHAPTER?

  • How BOSH keeps track of sessions

  • Using Strophe to attach to sessions

  • Improving performance with attachment

  • Using attachment for persistence

  • Increasing security with attachment

One of the more advanced uses of Strophe is session attachment. Instead of initiating a fresh XMPP connection when the application starts, a connection is provided that is already set up along with a little extra information that Strophe can use to attach to it. The connection may have been set up by server-side logic or by a previous page in the application.

Session attachment can solve a variety of problems relating to security, session persistence, and performance. Most of the time you probably won't need session attachment, but when your application does need it, it really comes in handy.

Although session attachment can provide faster application startup times or enhanced security, it comes with the cost of doing more work to prepare and manage the connection.

Knowing when to use session attachment is as important as knowing how to use it. In this chapter you are introduced to the common use cases and mechanics of attaching to already-established sessions.

Unlike the other chapters in this book, it is impossible to demonstrate session attachment with pure JavaScript code. This chapter contains some additional server-side code to handle session creation that will not be fully covered in the text.

SESSION ATTACHMENT

Session attachment is one of ...

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