[undertow-dev] Creating a websocket proxy with undertow

Marc Boorshtein marc.boorshtein at tremolosecurity.com
Sun Dec 2 08:36:10 EST 2018


On Fri, Nov 30, 2018 at 2:41 PM Marc Boorshtein <
marc.boorshtein at tremolosecurity.com> wrote:

> Thanks Stuart.  I need to avoid annotations since this will be configured
> dynamically.  I was wrong about the version, right now i'm on 2.0.9.Final.
> I'm trying to create a websocket proxy.  I was able to get the
> ReceiveListener registered in Undertow and create a WebSocketClient.  I'm
> trying to pipe the data from the client through Undertow to the server,
> starting with a Text message:
>
> @Override
> protected void onText(WebSocketChannel webSocketChannel,
> StreamSourceFrameChannel messageChannel)
> throws IOException {
> PooledByteBuffer b = pool.allocate();
> ByteBuffer buffer = b.getBuffer();
> while (messageChannel.read(buffer) > 0) {
> WebSockets.sendText(buffer, wsClient, null);
> }
> b.close();
> }
>
>
>
>

After reading through the unit tests i found BufferedTextMessage which did
the trick.  Great having well written test cases, they've been incredibly
helpful as I work my way through this.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20181202/3926d020/attachment.html 


More information about the undertow-dev mailing list