<div dir="ltr"><div dir="ltr">Thanks Stuart.  I need to avoid annotations since this will be configured dynamically.  I was wrong about the version, right now i&#39;m on 2.0.9.Final.  I&#39;m trying to create a websocket proxy.  I was able to get the ReceiveListener registered in Undertow and create a WebSocketClient.  I&#39;m trying to pipe the data from the client through Undertow to the server, starting with a Text message:<div><br></div><div><div>@Override</div><div><span style="white-space:pre">        </span>protected void onText(WebSocketChannel webSocketChannel, StreamSourceFrameChannel messageChannel)</div><div><span style="white-space:pre">                        </span>throws IOException {</div><div><span style="white-space:pre">                </span>PooledByteBuffer b = pool.allocate();</div><div><span style="white-space:pre">                </span>ByteBuffer buffer = b.getBuffer();</div><div><span style="white-space:pre">                </span>while (messageChannel.read(buffer) &gt; 0) {</div><div><span style="white-space:pre">                        </span>WebSockets.sendText(buffer, wsClient, null);</div><div><span style="white-space:pre">                </span>}</div><div><span style="white-space:pre">                </span></div><div><span style="white-space:pre">                </span>b.close();</div><div><span style="white-space:pre">        </span>}</div><div><br></div><div><br></div><div><div class="gmail-m_-9014391979265479174gmail_signature">The message sent to the downstream websocket server isn&#39;t right though (and the server rejects it).  The frame from wireshark just shows a buffer of &quot;\000\000...&quot;.  I think I&#39;m close but I don&#39;t see an example of how to do this.  Any suggestions or pointers would be greatly appreciated.</div><div class="gmail-m_-9014391979265479174gmail_signature"><br></div><div class="gmail-m_-9014391979265479174gmail_signature">Thanks</div><div class="gmail-m_-9014391979265479174gmail_signature"><br></div><div class="gmail-m_-9014391979265479174gmail_signature"><br></div><div dir="ltr" class="gmail-m_-9014391979265479174gmail_signature"><br></div><div dir="ltr" class="gmail-m_-9014391979265479174gmail_signature">Marc Boorshtein<br><br></div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 29, 2018 at 5:07 PM Stuart Douglas &lt;<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr">The easiest way would probably be to use the JSR-356 API. You basically just make an @ServerEndpoint that connects to the remote endpoint, and then passes messages back and forth. The JSRWebSocketServer gives and example of how to setup the server endpoint.<div><br></div><div><div>Stuart</div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Nov 30, 2018 at 8:34 AM Marc Boorshtein &lt;<a href="mailto:marc.boorshtein@tremolosecurity.com" target="_blank">marc.boorshtein@tremolosecurity.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">Using the 1.4 series, I&#39;m trying to handle upgrade and websockets.  Looking at a few examples and the code I think what I need to do is:<div><br></div><div>1.  add the WebSocketServlet to the right path</div><div>2.  implement WebSocketConnectionCallback that will call my remote ws:// server</div><div><br></div><div>Am I on the right track?  I haven&#39;t found an example of doing this with undertow but found something similar with jetty (<a href="https://github.com/chipster/chipster-web-server/blob/master/src/main/java/fi/csc/chipster/proxy/WebSocketProxyServlet.java" target="_blank">https://github.com/chipster/chipster-web-server/blob/master/src/main/java/fi/csc/chipster/proxy/WebSocketProxyServlet.java</a>) but I havne&#39;t found the same thing for undertow so any pointers would be appreciated.</div><div><br></div><div>Thanks</div><div><br></div><div><br clear="all"><div><div dir="ltr" class="m_-9014391979265479174m_4422610381707655478m_-3213897074540959509m_-1016323165206950582gmail_signature">Marc Boorshtein<br><br><br></div></div></div></div></div></div>
_______________________________________________<br>
undertow-dev mailing list<br>
<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a></blockquote></div>
</blockquote></div>