Page 1 of 1

JavaScript Error if no push element found

Posted: 06 Jul 2012, 14:19
by matej.kosco
Hi all,

I found an issue in the push JavaScript.

I'm trying to send a push request from my backing bean

Code: Select all

RequestContext.getCurrentInstance().push("test", "update");
however, I get an error on line 410 in core.js

Code: Select all

PrimeFaces.websockets[channel].send(message);
Uncaught TypeError: Cannot call method 'send' of undefined

PrimeFaces.websockets[channel] gets created with the PrimeWebSocket widget but there is no <p:push/> element in my .xhtml file (yet), hence the error.

reproduced in Chromium 18 and Firefox 13

Thanx for fixing,
Matej

Re: JavaScript Error if no push element found

Posted: 06 Jul 2012, 14:28
by matej.kosco
btw. can anybody suggest how to override the code without having to copy the wholle PrimeFaces.ajax.AjaxUtils?
Unfortunately I can't extend it since it doesn't use the Class.extend() function

thanks

Re: JavaScript Error if no push element found

Posted: 06 Jul 2012, 15:13
by cagatay.civici
Better to wait for PrimeFaces 3.4 as it is being reimplemented now based on atmosphere.

Re: JavaScript Error if no push element found

Posted: 06 Jul 2012, 17:59
by matej.kosco
will do. thanks!

Re: JavaScript Error if no push element found

Posted: 12 Jul 2012, 12:44
by cagatay.civici
This and many other limitations are fixed now in PrimeFaces 3.4.