Reload of the page causes multiple request

19 views
Skip to first unread message

Veeramani

unread,
May 31, 2012, 4:54:22 AM5/31/12
to cometd-users
When the JSP page which is subscribed to a channel gets reloaded,
there are multiple requests fired hitting the server as if load
testing is happening.

The following is the code that is used in the jsp page.

dojo.require("dojo.io.cometd");
dojo.io.cometd.init({}, "/bayeux/cometd");
dojo.io.cometd.subscribe("/callback/channel/jsp", null, "onUpdate");

When the F5 key (refresh) is pressed, the request is happening few
thousand times before it goes for long pooling.

Anyone faced this issue please?

Thanks
Veera

Simone Bordet

unread,
May 31, 2012, 4:58:27 AM5/31/12
to cometd...@googlegroups.com
Hi,

On Thu, May 31, 2012 at 10:54 AM, Veeramani <kveer...@gmail.com> wrote:
> When the JSP page which is subscribed to a channel gets reloaded,
> there are multiple requests fired hitting the server as if load
> testing is happening.
>
> The following is the code that is used in the jsp page.
>
> dojo.require("dojo.io.cometd");

That's not the right require() for cometd.
No idea what you're requiring here, but for CometD is
require("dojox/cometd") (Dojo 1.7+).

> dojo.io.cometd.init({}, "/bayeux/cometd");

URL must be absolute.

> dojo.io.cometd.subscribe("/callback/channel/jsp", null, "onUpdate");

Doing a subscribe just after init() is wrong.

Please read the documentation about the API usage at
http://docs.cometd.org/reference/#javascript

Simon
--
http://cometd.org
http://intalio.com
http://bordet.blogspot.com
----
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless.   Victoria Livschitz

Veeramani

unread,
May 31, 2012, 6:06:31 AM5/31/12
to cometd-users
Hi,

I am following the example from the following link:

http://docs.oracle.com/cd/E12840_01/wls/docs103/webapp/pubsub.html#wp158992
Section: Updating a Browser Client to Communicate with the Pub-Sub
Server

The question is when the page is reloaded, hundreds of requests are
fired. What can go wrong here please?

Thanks
Veera



On May 31, 1:58 pm, Simone Bordet <sbor...@intalio.com> wrote:
> Hi,
>
> On Thu, May 31, 2012 at 10:54 AM, Veeramani <kveeram...@gmail.com> wrote:
> > When the JSP page which is subscribed to a channel gets reloaded,
> > there are multiple requests fired hitting the server as if load
> > testing is happening.
>
> > The following is the code that is used in the jsp page.
>
> > dojo.require("dojo.io.cometd");
>
> That's not the right require() for cometd.
> No idea what you're requiring here, but for CometD is
> require("dojox/cometd") (Dojo 1.7+).
>
> > dojo.io.cometd.init({}, "/bayeux/cometd");
>
> URL must be absolute.
>
> > dojo.io.cometd.subscribe("/callback/channel/jsp", null, "onUpdate");
>
> Doing a subscribe just after init() is wrong.
>
> Please read the documentation about the API usage athttp://docs.cometd.org/reference/#javascript
>
> Simon
> --http://cometd.orghttp://intalio.comhttp://bordet.blogspot.com

Simone Bordet

unread,
May 31, 2012, 6:40:40 AM5/31/12
to cometd...@googlegroups.com
Hi,

On Thu, May 31, 2012 at 12:06 PM, Veeramani <kveer...@gmail.com> wrote:
> Hi,
>
> I am following the example from the following link:
>
> http://docs.oracle.com/cd/E12840_01/wls/docs103/webapp/pubsub.html#wp158992
> Section: Updating a Browser Client to Communicate with the Pub-Sub
> Server
>
> The question is when the page is reloaded, hundreds of requests are
> fired. What can go wrong here please?

No idea, you are using a different library, not CometD.
You should ask to Oracle.

If, instead, you decide to use CometD, then we may be able to help you.
Reply all
Reply to author
Forward
0 new messages