atmosphere icon indicating copy to clipboard operation
atmosphere copied to clipboard

[long-polling] AbstractReflectorAtmosphereHandler does not resume on broadcast

Open nite23 opened this issue 13 years ago • 3 comments

When using a custom handler that extends AbstractReflectorAtmosphereHandler, with long-polling transport, connection does not get resumed when the message is broadcasted. The issue is with the resource associated with the onStateChange event; AtmosphereResource#resumeOnBroadcast() returns false for some reason.

Tested on 1.1.0beta2

Here's a workaround for now:

    @Override
    public void onStateChange(AtmosphereResourceEvent event) throws IOException {
        super.onStateChange(event);
        if (event.isResuming()){
            return;
        }
        if(!event.getResource().resumeOnBroadcast() && 
                event.getResource().transport().equals(TRANSPORT.LONG_POLLING)){
            event.getResource().resume();
        }
    }   

nite23 avatar Jan 09 '13 20:01 nite23

@nite23 Stupid question, but are you calling resumeOnBroadcast on the AtmosphereResource? If not, then just install the AtmosphereResourceLifecycleInterceptor so it does it for you. But by default, you need to call it.

jfarcand avatar Jan 09 '13 20:01 jfarcand

Closing as not a bug.

jfarcand avatar Jan 09 '13 20:01 jfarcand

Works now, thanks! I missed that one in documentation...

nite23 avatar Jan 09 '13 20:01 nite23