<div dir="ltr">Thanks for the quick reply, but unfortunately it didn&#39;t help.<div>I changed the mapping, removed asterisk, but it&#39;s still not working.</div><div>I&#39;m not using any annotations or interceptors, it&#39;s the simplest setup possible.</div>
<div>Just an ordinary AtmosphereHandler implementation. AtmosphereHander is registered directly with AtmosphereFramework through init parameter of AtmosphereServlet.</div><div>You can see the full code at: <a href="https://github.com/djotanov/atmosphere-undertow">https://github.com/djotanov/atmosphere-undertow</a></div>
<div><br></div><div>I thought that I missed some configuration parameter in undertow but it seems that that is not the case since the same config works for you. I guess I will have to dig deeper into undertow code.</div><div>
<br></div><div>Thanks,</div><div>Dragan</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 13, 2014 at 4:01 PM, Aleksandar Vidakovic <span dir="ltr">&lt;<a href="mailto:cheetah@monkeysintown.com" target="_blank">cheetah@monkeysintown.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Hi Dragan,<br>
    <br>
    ... I just had a similar issue a couple of days ago... my setup is
    slightly different from yours (using Spring behind the scenes), but
    it shouldn&#39;t matter...<br>
    <br>
    The problem was (in my case) the Atmosphere servlet mapping and the
    path parameter in the annotated handler service... <br>
    <br>
    I had (like you) an asterisk (&quot;*&quot;) in the servlet mapping and that
    lead to a similar problem that you are describing (messages seem to
    arrive on the server side, but broadcasts to subscribed clients
    don&#39;t work).<br>
    <br>
    Also: Atmosphere was picky concerning the path parameter in my
    annotated handler service (see below).<br>
    <br>
    So... I&#39;d suggest you try something like this (just showing the
    relevant parts):<br>
    <br>
    [java]<br>
    <br>
    public class Bootstrap {<br>
    ...<br>
    <br>
        .addMapping(&quot;/chat&quot;)<br>
    <br>
    ...<br>
        // Not sure if this is required and related to your problem...
    including it anyway...<br>
        final Xnio xnio = Xnio.getInstance(&quot;nio&quot;,
    Undertow.class.getClassLoader());<br>
        final XnioWorker xnioWorker =
    xnio.createWorker(OptionMap.builder().getMap());<br>
        final WebSocketDeploymentInfo webSockets = new
    WebSocketDeploymentInfo().setWorker(xnioWorker);<br>
    <br>
        servletBuilder.addServletContextAttribute(ATTRIBUTE_NAME,
    webSockets);<br>
    <br>
    ...<br>
    <br>
        final DeploymentManager manager =
    defaultContainer().addDeployment(servletBuilder);<br>
        manager.deploy();<br>
    <br>
        // Not sure if it matters, but I don&#39;t use a path handler<br>
        Undertow server = Undertow.builder()<br>
                .addHttpListener(&quot;8080&quot;, &quot;localhost&quot;)<br>
                .setHandler(manager.start())<br>
                .build();<br>
        server.start();<br>
    }<br>
    <br>
    // Not sure if you are using the annotations... including it
    anyway... I think at least the path parameter has to be defined
    (interceptors can also be defined in servlet init param)...
    Atmosphere didn&#39;t pick the handler in my case when left out<br>
    @Singleton<br>
    @ManagedService(<br>
        path = &quot;/{id}&quot;, <br>
        broadcasterCache = UUIDBroadcasterCache.class, <br>
        interceptors = {AtmosphereResourceLifecycleInterceptor.class,
    CorsInterceptor.class, TrackMessageSizeInterceptor.class,
    SuspendTrackerInterceptor.class}, <br>
        broadcaster = SimpleBroadcaster.class)<br>
    public class Chat {<br>
    ...<br>
    }<br>
    <br>
    [/java]<br>
    <br>
    ... and then on the client side:<br>
    <br>
    [javascript]<br>
    <br>
    var globalCallback = function (response) {<br>
        // do something<br>
    };<br>
    <br>
    var roomId = &#39;123&#39;;<br>
    <br>
    var rq = $.atmosphere.subscribe(&#39;<a href="http://localhost:8080/chat/" target="_blank">http://localhost:8080/chat/</a>&#39; +
    roomId, globalCallback, $.atmosphere.request = {<br>
        enableXDR: true,<br>
        logLevel: &#39;debug&#39;,<br>
        contentType: &#39;application/json&#39;,<br>
        transport: &#39;websocket&#39;,<br>
        onError: function (response) {<br>
        },<br>
        onClose: function (response) {<br>
        },<br>
        onOpen: function (response) {<br>
        },<br>
        onMessage: function (response) {<br>
        },<br>
        onReopen: function (request, response) {<br>
        },<br>
        onReconnect: function (request, response) {<br>
        },<br>
        onMessagePublished: function (response) {<br>
        },<br>
        onTransportFailure: function (reason, request) {<br>
        },<br>
        onLocalMessage: function (request) {<br>
        },<br>
        onFailureToReconnect: function (request, response) {<br>
        },<br>
        onClientTimeout: function(request){<br>
        },<br>
        callback: function () {<br>
        }<br>
    });<br>
    <br>
    [/javascript]<br>
    <br>
    Note: I am using the latest 2.2.0-RC1 jars with Atmosphere JQuery
    2.2.0<br>
    <br>
    Hope it helps...<br>
    <br>
    Cheers,<br>
    <br>
    Aleks<div><div class="h5"><br>
    <br>
    <div>On 13.05.2014 14:54, Dragan Jotanovic
      wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      <div dir="ltr">Hi,
        <div><br>
          <div>I&#39;m struggling to make simple chat atmosphere application
            to work with embedded undertow.</div>
          <div>The app seems to connect to websocket, and requests are
            passing through to AtmosphereHandler but response never
            reaches client. I suppose that I&#39;m missing something in my
            undertow configuration but don&#39;t know what. Same code works
            when dropped into Tomcat or Jetty.</div>
          <div><br>
          </div>
          <div>Here is my bootstrap class:</div>
          <div><br>
          </div>
          <div>
            <div>public class Bootstrap {</div>
            <div>    public static void main(String[] args) throws
              Exception {</div>
            <div>        // deploy to undertow</div>
            <div>
                      DeploymentInfo servletBuilder =
              Servlets.deployment()</div>
            <div>               
              .setClassLoader(Bootstrap.class.getClassLoader())</div>
            <div>                .setContextPath(&quot;&quot;)</div>
            <div>                .setDeploymentName(&quot;chat&quot;)</div>
            <div>                .setDefaultEncoding(&quot;UTF-8&quot;)</div>
            <div>                .setUrlEncoding(&quot;UTF-8&quot;)</div>
            <div>                .setResourceManager(new
              FileResourceManager(new File(&quot;&quot;), 0))</div>
            <div>                .addWelcomePage(&quot;index.html&quot;);</div>
            <div>       
              servletBuilder.addServlet(Servlets.servlet(&quot;AtmosphereServlet&quot;,
              AtmosphereServlet.class)</div>
            <div>               
              .addInitParam(&quot;org.atmosphere.cpr.AtmosphereHandler&quot;,
              &quot;org.atmosphere.samples.chat.Chat&quot;)</div>
            <div>                .addMapping(&quot;/chat/*&quot;)</div>
            <div>                .setAsyncSupported(true));</div>
            <div><br>
            </div>
            <div>        final WebSocketDeploymentInfo
              webSocketDeploymentInfo = new WebSocketDeploymentInfo();</div>
            <div>       
              servletBuilder.addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME,
              webSocketDeploymentInfo);</div>
            <div><br>
            </div>
            <div>        DeploymentManager manager =
              Servlets.defaultContainer().addDeployment(servletBuilder);</div>
            <div>        manager.deploy();</div>
            <div><br>
            </div>
            <div>        HttpHandler servletHandler = manager.start();</div>
            <div>        PathHandler path =
              Handlers.path(Handlers.redirect(&quot;/&quot;)).addPrefixPath(&quot;/&quot;,
              servletHandler);</div>
            <div>        Undertow server = Undertow.builder()</div>
            <div>                .addHttpListener(8080, &quot;0.0.0.0&quot;)</div>
            <div>                .setHandler(path)</div>
            <div>                .build();</div>
            <div>        server.start();</div>
            <div>    }</div>
            <div>}</div>
          </div>
        </div>
        <div><br>
        </div>
        <div>Does anyone know how to properly configure websockets
          support so that it works with Atmosphere Framework?</div>
        <div><br>
        </div>
        <div>Complete example can be seen here:</div>
        <div><a href="https://github.com/djotanov/atmosphere-undertow" target="_blank">https://github.com/djotanov/atmosphere-undertow</a><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>Regards,</div>
        <div>Dragan</div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>_______________________________________________
undertow-dev mailing list
<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a></pre>
    </blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
undertow-dev mailing list<br>
<a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a><br></blockquote></div><br></div></div>