Sharing connection between Browser's windows and tabs

nepa edited this page Oct 23, 2012 · 3 revisions


Step by Step Tutorials

Concepts & Architecture

15 Minutes Tutorial

Advanced Topics


Known WebServer Issues


External Documentations alpha

Clone this wiki locally

By default, the atmosphere.js library will open a new connection (based on the available transports: websocket, long-polling, streaming, sse, jsonp or ajax) every time a new window or tab is opened by the Browser. In some case it may be more efficient to share a connection between windows/tabs. To enable the mechanism, all you need to do is to set the shared property of an AtmosphereRequest object:

  var request = new $.atmopshere.AtmosphereRequest();
  request.shared = true;
  request.transport = 'websocket'

Now every time a new windows/tabs is opened, the connection will be shared and all events occurring on that connection will be dispatched to all windows/tabs.