title: Omnifaces socket + commandScript combinations
body: <p>I'd like to implement the OmniFaces &lt;o:socket&gt; with <a href="http://showcase.omnifaces.org/push/socket#ui" rel="nofollow noreferrer">the &lt;o:commandScript&gt; option as documented here</a>.</p>
  
  <p>My JSF page looks like:</p>
  
  <pre><code>&lt;h:form id="myForm"&gt;
      &lt;!-- the socket is by default disconnected. It will
           connect when the user selects a subChannel. 
           Setting the subChannel to "null" must disconnect
           the socket --&gt;
      &lt;o:socket channel="myChannel" scope="session"
                connected="#{myManager.subChannel ne null}"
                user="#{myManager.subChannel}"
                onmessage="someTestScript" onopen="onOpen" onclose="onClose"/&gt;
  
      &lt;o:commandScript name="someTestScript"
                       actionListener="#{myManager.testPush}"
                       render=":testValue" /&gt;
  
      &lt;!-- dummy rendering to check if everything is working --&gt;
      &lt;h:panelGroup id="testValue"
                    rendered="#{myManager.subChannel ne null}" &gt;
          &lt;h:outputText value="#{myManager.bbb} #{myManager.aaa}" /&gt;
      &lt;/h:panelGroup&gt;
  
      &lt;!-- To simplify: I have several buttons which allows
           the user to select the socket "user". The buttons
           are only displayed when no "user" is selected 
           (thus, socket is not connected yet as well) --&gt;
      &lt;p:dataGrid value=#{...a list...} var="sth" 
                  rendered="#{myManager.subChannel eq null"&gt;
  
          &lt;p:ajax event="click"
                  update="myForm"
                  listener="#{myManager.setSubChannel(sth.id)}" /&gt;
  
          &lt;p:panel&gt;
              &lt;h:outputText value=#{sth.text} /&gt;
          &lt;/p:panel&gt; 
  
      &lt;/p:dataGrid&gt;
  
      &lt;!-- Resetting --&gt;
      &lt;p:commandButton value="Reset"
                       actionListener="#{myManager.setSubChannel(null)"
                       update="myForm" /&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>My backing bean:</p>
  
  <pre><code>@Named(value = "myManager")
  @SessionScoped
  public class MyStuffManager implements Serializable{
  
      private Long subChannel = null;
      private Long aaa;
      private String bbb;
  
      public void testPush(Long aaa, String bbb){
         System.out.println("Text received: " + bbb + ", Number received: " + aaa);
         this.aaa = aaa;    
         this.bbb = bbb;
      }
  
      // getter &amp; setter
  
  }
  </code></pre>
  
  <p>My socket push point:</p>
  
  <pre><code>@Named 
  @ApplicationScoped
  public Class mySocket implements Serializable{
      @Inject
      @Push(channel = "myChannel")
      private PushContext socket;
  
      // Basically, all methods are triggered by CDI events. So
      // far, I just want to send an int and a String to see how
      // I send parameters.
      public void test(@Observes @MyEventQualifier AnEvent event) {
          Map&lt;String, Object&gt; input = new HashMap&lt;&gt;();
          input.put("aaa", 123456789);
          input.put("bbb", "a text");
          socket.send(input);
      }
  }
  </code></pre>
  
  <p>Currently, my situation is:</p>
  
  <ol>
  <li>When clicking a panel and the "reset" button, the socket properly connects and disconnect.</li>
  <li>Still according to linked documentation, the &lt;f:ajax&gt; option properly works but I cannot send parameters.</li>
  </ol>
  
  <p>However, my open points are:</p>
  
  <ol>
  <li>the &lt;o:socket&gt; has a "null" user attribute. Regardless if I use the "connect" attribute to trigger a connection or a <pre>oncomplete="OmniFaces.Push.open('myChannel')"</pre>, the subChannel is still resolved to null. Strangely enough, if I execute other JSF stuff (like updating an &lt;h:outputText&gt; field), the subChannel is properly updated and retrieved. <b>How should I have a dynamic "user" attribute depending on a EL when connection is not automatic?</b></li>
  <li>I have missed something from the OmniFaces documentation as the <b>myManager.testPush is never called. What have I missed?</b> Instead, I have a <i>ReferenceError: someTestScript is not defined</i> on my Firefox console. I tried to add an empty someTestScript in a JavaScript file but it looks like only the empty one is called, not the o:commandScript.</li>
  </ol>
  
  <p>We're using OmniFaces 2.6 as stated by the documentation.</p>
  
  <p>Any hint/advise is obviously welcomed. Thanks.</p>