0 Replies Latest reply on Sep 26, 2012 4:16 PM by errai_user

    Broadcast message from server to client

    errai_user

      i am trying to broadcast message from the server to the client.

      the environment GWT2.4 and Spring framework,JPA.

       

      client code:

       

      ErraiBus.get().subscribe("MessageListener", new MessageCallback() {

            @Override

            public void callback(Message message) {

                String count = message.get(String.class, "Text");

                 Window.alert(count);

               

      }});

       

      from the server i got the erraiService from jetty-env.xml JNDI:

       

      <New id="Errai" class="org.mortbay.jetty.plus.naming.Resource">

              <Arg><Ref id="sample-weld"/></Arg>

              <Arg>ErraiService</Arg>

              <Arg>

                  <New class="javax.naming.Reference">

                            <Arg>org.jboss.errai.bus.server.service.ErraiService</Arg>

                      <Arg>org.jboss.errai.container.ErraiServiceObjectFactory</Arg>

                      <Arg/>

                  </New>

              </Arg>

          </New>

       

      ErraiService erraiService = (ErraiService) new InitialContext().lookup("java:comp/env/ErraiService");

      MessageBuilder.createMessage().toSubject("MessageListener").with("Text", "hello, errai").noErrorHandling().sendGlobalWith(bus);

       

      from the console i can see the messagebuilder send the message, but the client did not receive this message, any suggestion.