0

I'm using the grails-events-push plugin and all goes well, but when the system is idle for a while (about 3 minutes), the connection is lost and it cannot reconnect with the server. When I refresh the page everything goes well again.

This is the error on chrome: WebSocket connection to 'ws://192.168.1.109:8080/EasyRestaurant//g-eventsbus/eventsbus?X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.1.5-jquery&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&X-Cache-Date=0&Content-Type=application/json&X-atmo-protocol=true' failed: Received a broken close frame containing a reserved status code.

After this error if I try to send an event another one appears: No suspended connection available. Make sure atmosphere.subscribe has been called and request.onOpen invoked before invoking this method.

I'm using atmosphere-javascript-2.1.5 in tomcat:7.0.52.1 (events-push:1.0.0.BUILD-SNAPSHOT and org.grails.plugins:events:1.0.0.BUILD-SNAPSHOT) I don't know which version of atmosphere use the grails-events-plugin.

Anyone knows where the problem is? Is it the atmosphere client in javascript or the grails-events-push plugin in grails? Is it tomcat?

Thanks!

1 Answer 1

0

I use the two interceptors below in my atmosphere plugin and sample app and haven't had any problems with disconnects or timeouts.

org.atmosphere.interceptor.AtmosphereResourceLifecycleInterceptor
org.atmosphere.interceptor.HeartbeatInterceptor

I took a quick look through Stephane's plugin code, but I didn't see an easy way to configure these.

You should be able to try the latest atmosphere release by adding the compile line below to your app's BuildConfig.groovy dependencies section. I'd give that a try first.

dependencies {
    // other dependencies
    compile 'org.atmosphere:atmosphere-runtime:2.1.3'
}

You could use my plugin, but you'd have to add your own events handling code. In my private app I use a Grails service to handle sending events and notifications, and it's not that difficult to implement.

4
  • I wanted to use the HeartbeatInterceptor but I didn't know how to configure. I will try in the same way you did in the config. If it works I will accept your answer! Thanks for your reply! May 21, 2014 at 12:30
  • @mpccolorado The way my plugin config works is completely different from the events-push plugin, so I don't think that'll work. Have you tried the latest atmosphere release?
    – Ken
    May 21, 2014 at 13:14
  • I will try the latest version of atmosphere as you suggested! Or maybe atmosphere-runtime:2.1.4 and atmosphere-javascript-2.1.4 for the client side. Because I'm using the original version of atmosphere which came with grails-events-push and atmosphere-javascript-2.1.5 for the client side (and maybe this is the problem). Thanks! May 21, 2014 at 14:58
  • I used the 2.1.4 version in the same way you proposed and it works like a charm! (I think it was a problem for using an old version of atmosphere in the server and a new one in the client side). Thanks! May 28, 2014 at 23:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.