long polling - JS and CSS file fails to load when the page is refreshed in grails application which uses Atmosphere Meteor plugin -


in grails 2.3.7 application, using atmosphere-meteor 0.8.3.

on home page load, subscribe client. , default run long-polling; , works fine. on page refresh, unsubscribe client.

however, if refresh page; of js , css fails load. happens 5 out of 10 times of refresh.

am doing wrong? (as subscribe on document.ready()). or need else?

any appreciated.

update:

code inside gsp subscription:

$('body').bind('beforeunload',function(){     jabber.unsubscribe(); }); $(document).ready(function () {      if (typeof atmosphere == 'undefined') {         jabber.socket = $.atmosphere;     } else {         jabber.socket = atmosphere;     }     var atmosphererequest = {         type: 'public',         url: 'atmosphere/public',         trackmessagelength: false     };     //settimeout(function(){         jabber.subscribe(atmosphererequest);     //}, 10000); }); 

and jabber variable

var jabber = {     socket: null,     publicsubscription: null,     transport: null,      subscribe: function (options) {         var defaults = {             type: '',             contenttype: "application/json",             shared: false,             //transport: 'websocket',             transport: 'long-polling',             fallbacktransport: 'long-polling',             trackmessagelength: true         },         atmosphererequest = $.extend({}, defaults, options);         console.log(atmosphererequest);         atmosphererequest.onopen = function (response) {             console.log('atmosphereopen transport: ' + response.transport);         };         atmosphererequest.onreconnect = function (request, response) {             console.log("atmospherereconnect");         };         atmosphererequest.onmessage = function (response) {             console.log("on message");             jabber.onmessage(response);         };         atmosphererequest.onerror = function (response) {             console.log('atmosphereerror: ' + response);         };         atmosphererequest.ontransportfailure = function (errormsg, request) {             console.log('atmospheretransportfailure: ' + errormsg);         };         atmosphererequest.onclose = function (response) {             console.log('atmosphereclose: ' + response);         };          switch (options.type) {         case 'public':             jabber.publicsubscription = jabber.socket.subscribe(atmosphererequest);             break;         default:             return false;         }         //jabber.publicsubscription = jabber.socket.subscribe(atmosphererequest);      },      unsubscribe: function () {         if (jabber.socket)             jabber.socket.unsubscribe();     },      onmessage:function(response){....} } 

i'm plugin author. please update version 1.0.1. if still have trouble after updating plugin, create new issue. can work through problem then. however, have question. when js fails load, mean atmosphere javascript or own? there no plugin related css.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -