title: Omnifaces: Socket; have multiple events / different remoteCommand scripts?
body: <p>I´m using o:socket for my chat application.
  Currently I can send and receive messages, but now I would like to have different events.
  Event1: sendMessage (send a message to channel)
  Event2: a user is typing.</p>
  
  <p>Currently my page is like that:</p>
  
  <pre><code>&lt;h:form&gt;
      &lt;o:socket channel="chatChannel"
          user="#{loginChatController.chatUser.id}" scope="view"
          onmessage="chatScript"&gt;
      &lt;/o:socket&gt;
  
      &lt;p:remoteCommand name="chatScript" immediate="true" update=":chatForm"
          global="false" /&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>Here my WebSocket:</p>
  
  <pre><code>@Named
  @ApplicationScoped
  public class ChatWebsocket implements Serializable {
  
      private static final long serialVersionUID = 7615791377170410627L;
  
          @Inject
          @Push(channel = "chatChannel")
          private PushContext push;
  
          /**
           * Push Chat
           * 
           * @param recipientUser
           */
          public void pushUser(@Observes ChatPushEvent event) {
  
              if (event.getChatUserList() == null)
                  return;
  
              push.send("chatForm", event.getChatUserList());
  
          }
  }
  </code></pre>
  
  <p>And here my ChatPushEvent class:</p>
  
  <pre><code>public class ChatPushEvent {
  
      private String message;
      private ChatUser chatUser;
      private List&lt;Long&gt; chatUserList;
  
      ////////////////////////////////////////////////////////
  
      public ChatPushEvent(String message, ChatUser chatUser) {
          super();
          this.message = message;
          this.chatUser = chatUser;
      }
  
      public ChatPushEvent(String message, List&lt;Long&gt; chatUserList) {
          super();
          this.message = message;
          this.chatUserList = chatUserList;
      }
  
      public List&lt;Long&gt; getChatUserList() {
          return chatUserList;
      }
  
      public void setChatUserList(List&lt;Long&gt; chatUserList) {
          this.chatUserList = chatUserList;
      }
  
      public String getMessage() {
          return message;
      }
  
      public void setMessage(String message) {
          this.message = message;
      }
  
      public ChatUser getChatUser() {
          return chatUser;
      }
  
      public void setChatUser(ChatUser chatUser) {
          this.chatUser = chatUser;
      }
  }
  </code></pre>
  
  <p>The idea is now to add at the ChatPushEvent class another String like "eventType". This can be "NORMAL_MESSAGE" or "TYPING"...</p>
  
  <p>In my JSF page I need now this to call p:remoteCommand1 or p:remoteCommand2:
  How can I do this / get the ChatPushEvent in the JSF page?</p>
  
  <p>So I need something like this</p>
  
  <pre><code>    &lt;h:form&gt;
          &lt;o:socket channel="chatChannel"
              user="#{loginChatController.chatUser.id}" scope="view"
              onmessage="chatScript"&gt;
          &lt;/o:socket&gt;
  
          &lt;p:remoteCommand name="chatScript" immediate="true" update=":chatForm"
              global="false" /&gt;
  
  &lt;p:remoteCommand name="chatScriptTyping" actionListener="doSomething" immediate="true" update=":chatForm"
              global="false" /&gt;
      &lt;/h:form&gt;
  </code></pre>
  
  <p>How can I call <strong>chatScriptTyping</strong> or <strong>chatScript</strong></p>