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

AtmosphereResourceLifecycleInterceptor does not resume resource for long-polling #594

Closed
janbols opened this issue Sep 3, 2012 · 5 comments

Comments

@janbols
Copy link

janbols commented Sep 3, 2012

According to the javadoc, the AtmosphereResourceLifecycleInterceptor takes care of resuming resources.
However it only sets resumeOnBroadcast to true. That's it. Nothing more. The only place, I can see, this flag being checked is in the AbstractReflectorAtmosphereHandler.

However for all other AtmosphereHandlers, this will not resume a suspended event when long-polling is used and data is written to it.

On Atmosphere 1.0.0.RC1

@jfarcand
Copy link
Member

@janbols, can you elaborate of the expected behavior? Thanks!

@janbols
Copy link
Author

janbols commented Sep 18, 2012

I would expect that, when using long-polling behavior, the AtmosphereResourceLifecycleInterceptor would take care of resuming and suspending as the javadoc shows. The only thing the custom AtmosphereHandler needs to do is write data if suspended like in the example below:

    public void onStateChange(AtmosphereResourceEvent event) throws IOException {
        if (event.isSuspended()) {
                event.getResource().getResponse().getWriter().write( event.getMessage().toString() );
        }
    }

However, when a message arrives, for long-polling, the AtmosphereResourceLifecycleInterceptor only sets a resumeOnBroadcast flag. It doesn't do resource.resume() or anything else. As a result resource.resume() is never called and no messages arrive.
Unless I'm doing something terribly wrong here.

@jfarcand
Copy link
Member

OK, clarified the documentation . Applicaiton needs to take care of resuming in case they don't use Broadcaster. Thanks!!!

@janbols
Copy link
Author

janbols commented Sep 21, 2012

Ok, thanks. Is it generally advised to extend from AbstractReflectorAtmosphereHandler?

@jfarcand
Copy link
Member

Yes as the logic can be quite complex...but not mandatory as everything can be done in an AtmosphereHandler as well. BTW take a look at the new OnMessage handler...that one is quite simple as well. Thanks for the feedback.

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