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 ...

Get Professional XMPP Programming with JavaScript® and jQuery now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.