Skip to content

Sharing connection between Browser's windows and tabs

SuperPat edited this page Aug 7, 2017 · 4 revisions

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 atmosphere.AtmosphereRequest();
  request.shared = true;
  request.transport = 'websocket';
  var socket = atmosphere.subscribe(request);

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.

Step by Step Tutorials

Concepts & Architecture

15 Minutes Tutorial

Advanced Topics

API

Known WebServer Issues

References

External Documentations

githalytics.com alpha

Clone this wiki locally