Seam.Remoting.subscribe() sends an asynchronous request to the server, which means
you're not guaranteed to have a token in the subscription registry by the time your
page gets to the script at the bottom of the page.
I suggested putting the code to set the token inside your callback method, because it is
synchronous with the subscription request. However if your callback method isn't
being called before the page is refreshed (because you haven't received any messages
during that time) then you can override SeamRemote.subscriptionCallback() instead:
| <script type="text/javascript">
| var cb = SeamRemote.subscriptionCallback;
| SeamRemote.subscriptionCallback = function(doc) {
| cb(doc);
| document.getElementById('token').value =
Seam.Remoting.subscriptionRegistry[0].token;
| }
| </script>
| }
|
Using setTimeout() is definitely not the way to do it.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978487#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...