Ah, looks like I forgot about a relatively recent optimization that was added. A new
method (AbstractFramedStreamSinkChannel.send) was added that allows you to send the whole
contents of a buffer in one frame (which prevents double copying into the internal stream
buffer). The WebSockets utility methods have been changed to use this method.
If you use the write() method instead of send() then it will use the internal buffer which
will limit the frame size to the internal buffer size (have a look in
io.undertow.util.StringWriteChannelListener for an example of how to use this).
Stuart
----- Original Message -----
From: "Guggemos Dominik (INST/ECS1)"
<Dominik.Guggemos(a)bosch-si.com>
To: "Stuart Douglas" <sdouglas(a)redhat.com>
Cc: undertow-dev(a)lists.jboss.org
Sent: Tuesday, 9 February, 2016 7:03:52 PM
Subject: AW: [undertow-dev] Undertow WebSocket maximum frame size
Basically we are using Undertow as shown in the ChatServer example
(
https://github.com/undertow-io/undertow/blob/master/examples/src/main/jav...)
i.e. no JSR-356 API. With the small difference that we are sending binary
data and we set a buffer size using the Undertow builder. As Websocket
client we are using the AsyncHttpClient
(
https://github.com/AsyncHttpClient/async-http-client) which then fails
receiving messages larger than the set buffer size with an exception saying
"Max frame length has been exceeded.". Example code here:
https://gist.github.com/dguggemos/3c1c3316052e1dbeb663
Dominik
-----Ursprüngliche Nachricht-----
Von: Stuart Douglas [mailto:sdouglas@redhat.com]
Gesendet: Montag, 8. Februar 2016 21:50
An: Guggemos Dominik (INST/ECS1)
Cc: undertow-dev(a)lists.jboss.org
Betreff: Re: AW: [undertow-dev] Undertow WebSocket maximum frame size
How are you using websockets?
If you are using the JSR-356 API and deploying using WebSocketDeploymentInfo
you need to change the buffer size for outgoing connections in the
setBuffers() call:
new WebSocketDeploymentInfo()
.setBuffers(new DefaultByteBufferPool(true,
1024))
Otherwise the buffer size from the Undertow builder should be used. Can you
provide an example of that you are doing?
Stuart
----- Original Message -----
> From: "Guggemos Dominik (INST/ECS1)"
<Dominik.Guggemos(a)bosch-si.com>
> To: "Stuart Douglas" <sdouglas(a)redhat.com>
> Cc: undertow-dev(a)lists.jboss.org
> Sent: Monday, 8 February, 2016 10:55:36 PM
> Subject: AW: [undertow-dev] Undertow WebSocket maximum frame size
>
> Hi Stuart,
>
> that's what I'm trying to do, sending large messages that consist of
> multiple frames.
>
> By buffer size do you mean this option:
>
> Undertow.builder().setBufferSize(1024)....?
>
> Because this doesn't work for me, the message (larger than 1024 bytes)
> is always transferred in one frame.
> Maybe you can provide an example how to do this correctly?
>
> Thanks, Dominik
>
> -----Ursprüngliche Nachricht-----
> Von: Stuart Douglas [mailto:sdouglas@redhat.com]
> Gesendet: Dienstag, 2. Februar 2016 10:44
> An: Guggemos Dominik (INST/ECS1)
> Cc: undertow-dev(a)lists.jboss.org
> Betreff: Re: [undertow-dev] Undertow WebSocket maximum frame size
>
> They the maximum size is determined by the buffer size (although this
> refers to individual frames, you can still send larger messages using
> continuation frames).
>
> Stuart
>
> ----- Original Message -----
> > From: "Guggemos Dominik (INST/ECS1)"
<Dominik.Guggemos(a)bosch-si.com>
> > To: undertow-dev(a)lists.jboss.org
> > Sent: Tuesday, 2 February, 2016 8:07:23 PM
> > Subject: [undertow-dev] Undertow WebSocket maximum frame size
> >
> >
> >
> > Hi,
> >
> >
> >
> > is it possible to limit the frame size of WebSocket messages sent
> > from Undertow? I didn’t find anything related in the configuration or
> > options.
> >
> >
> >
> > Thanks,
> >
> > Dominik
> >
> > _______________________________________________
> > undertow-dev mailing list
> > undertow-dev(a)lists.jboss.org
> >
https://lists.jboss.org/mailman/listinfo/undertow-dev
>