Atmosphere does not invoke all callbacks for shared websocket connections

399 views Asked by At

I decided to test how atmosphere framework works with shared websocket connections (shared between browser tabs).

For this I used the sample chat with several little modification in client-side:

  1. I create request as function (so it can be passed to callbacks list inside the atmosphere):

    var request = function() {};

  2. for using shared connections I set the appropriate property to true (see link to docs):

    request.uuid = $.atmosphere.guid(); request.url = '${url}'; request.contentType = "application/json"; request.transport = 'websocket'; request.fallbackTransport = 'long-polling'; request.shared = true; request.trackMessageLength = true; request.reconnect = true; request.connectTimeout = -1; request.reconnectInterval = 5000; request.timeout = 300000; request.maxRequest = -1;

  3. I pass this request to atmosphere

    subsocket = $.atmosphere.subscribe(request, request, request);

And after this everything works perfect (onMessage callback is invoked every time it should be invoked) except one important thing: for other opened tabs which use shared already opened websocket connection the onMessage callback is never invoked at all. So it makes the feature useless, because I couldn't use it.

Could anybody help me with this problem? I believe I do something wrong, but I really need your help.

0

There are 0 answers