[undertow-dev] Undertow WebSocket maximum frame size

Guggemos Dominik (INST/ECS1) Dominik.Guggemos at bosch-si.com
Tue Feb 9 03:03:52 EST 2016


Basically we are using Undertow as shown in the ChatServer example (https://github.com/undertow-io/undertow/blob/master/examples/src/main/java/io/undertow/examples/chat/ChatServer.java) 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 at redhat.com] 
Gesendet: Montag, 8. Februar 2016 21:50
An: Guggemos Dominik (INST/ECS1)
Cc: undertow-dev at 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 at bosch-si.com>
> To: "Stuart Douglas" <sdouglas at redhat.com>
> Cc: undertow-dev at 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 at redhat.com]
> Gesendet: Dienstag, 2. Februar 2016 10:44
> An: Guggemos Dominik (INST/ECS1)
> Cc: undertow-dev at 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 at bosch-si.com>
> > To: undertow-dev at 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 at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/undertow-dev
> 



More information about the undertow-dev mailing list