dimanche 28 juin 2015

a4j:push not using websockets and falling back to long-polling

I am using Richfaces 4.2.2 for my project and from this link, figured out that atmosphere 0.8.4 needs to be used for compatibility. I am able to get push working but it is using long-polling instead of websockets. Webserver is Jboss 8.2 (undertow).

Following configurations were done to achieve this:

<context-param>
    <param-name>org.richfaces.push.initializeOnStartup</param-name>
    <param-value>true</param-value>
</context-param>
 <context-param>  
    <param-name>org.atmosphere.useBlocking</param-name>  
    <param-value>true</param-value>  
 </context-param> 

On server side, push notifications are send to client using

TopicKey topicKey = new TopicKey(key);
TopicsContext topicsContext = TopicsContext.lookup();
topicsContext.publish(topicKey, message);

On client side, notifications are received as. I have added script block to use transport for push as websocket, but it seems to be failing.

<script>
   Richfaces.Push.transport = "websocket";  
   Richfaces.Push.fallbackTransport = "long-polling;  
</script>  

<a4j:region>
    <a4j:push address="update">
        <a4j:ajax event="dataavailable" render="someelements"/>
    </a4j:push>
</a4j:region>

Can anyone guide me along with the missing configurations? OR it is the limitation with the current version of richfaces/atmosphere that long-polling is the only supported transport mechanism?

Aucun commentaire:

Enregistrer un commentaire