4 Replies Latest reply on Jul 25, 2014 5:53 PM by Christian Sadilek

    ErraiBus and Server Side Events (SSE)

    Uemit Seren Newbie

      I have been using ErraiBus (version 2.3.0.Final) as a standalone dependency in my GWT application for push notifications and it worked flawless.

       

      Recently I updated to the latest version 2.4.4.Final and the push notifications (server -> client) stopped to work. The only difference as far as I can tell is that instead of LongPolling in the new version Server Side Events are used.

       

      I am using the DefaultBlockingServlet in Jetty 8.1. According to the console the SSE is properly setup and validated.

      However it seems that the callback on the client is not executed.

       

      web.xml code:

       

          <servlet>

              <servlet-name>ErraiServlet</servlet-name>

              <servlet-class>org.jboss.errai.bus.server.servlet.DefaultBlockingServlet</servlet-class>

              <init-param>

                  <param-name>auto-discover-services</param-name>

                  <param-value>true</param-value>

              </init-param>

              <load-on-startup>1</load-on-startup>

          </servlet>

         <servlet-mapping>

              <servlet-name>ErraiServlet</servlet-name>

              <url-pattern>*.erraiBus</url-pattern>

          </servlet-mapping>

       

      Client side code:

          MessageBus messageBus = ErraiBus.get();

          messageBus.subscribe("BroadcastReceiver", new MessageCallback() {

                  @Override

                  public void callback(Message message) {

                      logger.log(Level.INFO,"Event receiver");

                  }

              });

       

      Server side code:

       

      MessageBuilder.createMessage("BroadcastReceiver")

              .signalling()

              .noErrorHandling()

              .sendNowWith(dispatcher);