[jboss-user] [JBoss Seam] - Re: Seam Remoting und JMS Topic subscription questions.

appendix do-not-reply at jboss.com
Fri Oct 13 02:33:56 EDT 2006


Hi, thanks for your reply!

I've tried to follow your hint, but somehow it seems that I cannot access the token after subscription to be able to write it to an input field.

The xhtml page is defined as following:


  | <script type="text/javascript">
  | //<![CDATA[
  |  Seam.Remoting.setDebug(true);
  | 
  |  function connect() {
  |   for (var i = 0; i < Seam.Remoting.subscriptionRegistry.length; i++){
  |     Seam.Remoting.log(Seam.Remoting.subscriptionRegistry.topic);
  |   }
  |   Seam.Remoting.subscribe("taskListTopic", channelMessageCallback);  
  |  }
  | 
  |  Seam.Remoting.setPollTimeout(10);
  |  Seam.Remoting.setPollInterval(3);
  |  connect();   
  | 
  |  function channelMessageCallback(message) {
  |   Seam.Remoting.log("msg.rcvd");
  |   window.location.href=window.location.href;		
  |  }
  | // ]]>
  | </script>
  | <!--  /Seam Remoting -->
  | 
  | <f:view>
  |  <h2><h:outputText value="#{msgs['home.Title']}" /></h2>
  | <!-- here follows the view [.. snipped .. ] -->
  | </f:view>
  | 
  | <script type="text/javascript">
  | //<![CDATA[
  |  Seam.Remoting.log("Script at the bottom of page...");
  |  
  |  function fillTokenField(){
  |   Seam.Remoting.log("filling input field with token");
  |   var tokenField = document.getElementById('token');
  |   tokenField.value="somethg";
  |   Seam.Remoting.log(tokenField.value);
  |   for (var i = 0; i < Seam.Remoting.subscriptionRegistry.length; i++){
  |    Seam.Remoting.log(i+": "+Seam.Remoting.subscriptionRegistry.topic+": "+Seam.Remoting.subscriptionRegistry.token);
  |   }
  |   tokenField.value = Seam.Remoting.subscriptionRegistry[0].token;
  |   Seam.Remoting.log(tokenField.value);
  |  }
  |  
  |  fillTokenField(); 
  | // ]]>
  | </script>
  | 
After the page has been called, Seam log shows the following content:


  | Fri Oct 13 2006 08:09:54 GMT+0200: Request packet:
  | <envelope><body><subscribe topic="taskListTopic"/></body></envelope>
  | 
  | Fri Oct 13 2006 08:09:54 GMT+0200: Script at the bottom of page...
  | 
  | Fri Oct 13 2006 08:09:54 GMT+0200: filling input field with token
  | 
  | Fri Oct 13 2006 08:09:54 GMT+0200: somethg
  | 
  | Fri Oct 13 2006 08:09:54 GMT+0200: 0: taskListTopic: undefined
  | 
  | Fri Oct 13 2006 08:09:54 GMT+0200: undefined
  | 
  | Fri Oct 13 2006 08:09:54 GMT+0200: Response packet:
  | <envelope><body><subscription topic="taskListTopic" token="ba340565-eeba-483f-9d10-9171e8fac57d"/></body></envelope>
  | 
  | Fri Oct 13 2006 08:09:54 GMT+0200: Request packet:
  | <envelope><body><poll token="ba340565-eeba-483f-9d10-9171e8fac57d" timeout="10"/></body></envelope>
  | 

The last two lines of the log are the first polling performed. But as seen, at the point where the subscription list is written to the log, the token for the current subscription is 'undefined'.

When is the token initialized?
Am I missing something obvious?

And just to make sure, I got you right, after I've written the token to an input field, I need to make sure this token is pushed into the subscriptionRegistry again after the page has reloaded. 
After that I start the polling process with Seam.Remoting.poll(), right?

Thank you again,

	Kurt




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978083#3978083

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978083



More information about the jboss-user mailing list