IE10 - Atmosphere Unsubscribed when AJAX Call Made

121 views Asked by At

We are integrating Atmosphere into our current application. Everything works great in IE 11 and the latest version of Chrome. In IE 10 however, we are unabled to receive push notifications after the client makes an AJAX call to the server.

We turned on Atmosphere debugging, and here is the log in IE 10.

Invoking executeWebSocket

Using URL: ws://t1c.lh.com:8080/wicket/page?12-IResourceListener.9-&X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.0.8-jquery&X.....

Websocket successfully opened

Invoking 1 global callbacks: opening

....Do an already existing AJAX request.....

Invoking 1 global callbacks: unsubscribe

Websocket closed normally

After the unsubscribe call, the client no longer receives server push events. This unsubscribe call does not happen in IE 11. IE 11 receives push notification without an issue.

Any ideas on how to fix?

Here is our atmosphere setup. Using Tomcat 8.0.23.

<servlet>
    <description>Atmospherefilter</description>
    <servlet-name>Atmospherefilter</servlet-name>
    <servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class>
    <init-param>
        <param-name>applicationClassName</param-name>
        <param-value>AppClassHere</param-value>
    </init-param>
    <init-param>
        <param-name>configuration</param-name>
        <param-value>development</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.useWebSocket</param-name>
        <param-value>false</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.useNative</param-name>
        <param-value>false</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.cpr.sessionSupport</param-name>
        <param-value>true</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.websocket.maxIdleTime</param-name>
        <param-value>60000</param-value>
    </init-param>
    <init-param>
       <param-name>org.atmosphere.useWebSocketAndServlet3</param-name>
       <param-value>true</param-value>
    </init-param>
    <init-param>
       <param-name>org.atmosphere.cpr.asyncSupport</param-name>
       <param-value>org.atmosphere.container.JSR356AsyncSupport</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.cpr.broadcastFactory</param-name>
        <param-value>org.atmosphere.cpr.DefaultBroadcasterFactory</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>
        <param-value>org.atmosphere.cache.UUIDBroadcasterCache</param-value>
    </init-param>
    <init-param>
        <param-name>filterMappingUrlPattern</param-name>
        <param-value>/*</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.websocket.WebSocketProtocol</param-name>
        <param-value>org.atmosphere.websocket.protocol.EchoProtocol</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.cpr.broadcastFilterClasses</param-name>
        <param-value>org.apache.wicket.atmosphere.TrackMessageSizeFilter</param-value>
    </init-param>
    <load-on-startup>0</load-on-startup>
    <async-supported>true</async-supported>
</servlet>
<servlet-mapping>
    <servlet-name>Atmospherefilter</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

Thanks, Matt

2

There are 2 answers

0
jfarcand On

Can you share an end to end test case that reproduce the issue? But first, please make sure you try with a more recent version of the javascript client:

https://github.com/Atmosphere/atmosphere-javascript

Just send your test case to the mailing list

https://groups.google.com/group/atmosphere-framework?pli=1

-- Jeanfrancois (Atmosphere's lead)

0
Matt Ashley On

I've figured it out. IE 10 unloads a the page if a link is click with href="javascript:void(0);". All of our links had this (and onclick attributes for AJAX calls) causing onbeforeunload to run which contained the atmosphere unsubscribe code.

I've verified removing the href solves the issue. New version of IE and Chrome do not unload the page when href="javascript:void(0);" is present.

Reference link: Why IE10 fires beforeunload event when clicking on anchor element with javascript href and how to prevent it

Thanks for following up!