Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with long-polling and broadcast multiple times #916

Closed
omar-aguilar opened this issue Feb 19, 2013 · 1 comment
Closed

Issue with long-polling and broadcast multiple times #916

omar-aguilar opened this issue Feb 19, 2013 · 1 comment

Comments

@omar-aguilar
Copy link

Hi

Trying to add support for long-polling using atmosphere, found that when broadcasting multiple times too fast the response sometimes get lost

Looks like atmosphere uses the last get request to send the response and as there is no other get request created when broadcasting the second response this last one is lost

Some of the used logic
When subscribing the app the app sets an event listener, a broadcast for the resource, and suspends the connection

  resource.addEventListener(new WebSocketEventListenerAdapter() {
    ...
  });
  resource.setBroadcaster(BroadcasterFactory.getDefault().lookup(identifier, true));
  if (AtmosphereResource.TRANSPORT.LONG_POLLING.equals(resource.transport())) {
      resource.resumeOnBroadcast(true).suspend(-1);
  } else {
      resource.suspend(-1);
  }

When pushing data re-set the broadcaster to the resource and broadcast a response

  resource.setBroadcaster(BroadcasterFactory.getDefault().lookup(identifier));
  //do processing
  resource.getBroadcaster().broadcast(response);

Tried this with 1.0.9, 1.0.10 and 1.1.0.beta3 with the same results
Using websockets it works fine

Regards

@jfarcand
Copy link
Member

Have you installed a BroadcasterCache? Let's have the discussion on the mailing list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants