As we can see in the code snippet below, it is not possible to send TextMessage where isLast is set to false.

https://github.com/spring-projects/spring-framework/blob/43ff6d9711540a8ca048867a27fb42db4a232c70/spring-websocket/src/main/java/org/springframework/web/socket/adapter/jetty/JettyWebSocketSession.java#L218-L220

https://github.com/spring-projects/spring-framework/blob/43ff6d9711540a8ca048867a27fb42db4a232c70/spring-websocket/src/main/java/org/springframework/web/socket/TextMessage.java#L62-L65

However, the API exists in Jetty, in the form of Session#sendPartialText(String, boolean, Callable). Is there any reason for not using it?

https://github.com/jetty/jetty.project/blob/jetty-12.0.x/jetty-core/jetty-websocket/jetty-websocket-jetty-api/src/main/java/org/eclipse/jetty/websocket/api/Session.java#L99-L110

From basic testing, it seems that calling it is still not complying, but I may have made boggus changes and broken the code.

Thank you for any reply

Comment From: sdeleuze

I am not sure about the reason, but FWIW tests are green when doing this change. Notice the same apply to binary messages with Session#sendPartialBinary.

@OPeyrusse I am not sure to understand "From basic testing, it seems that calling it is still not complying", could you please elaborate? @rstoyanchev Do you know if there is a good reason or if you think there is something to refine here?

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: OPeyrusse

@sdeleuze Yes. I haven't looked at #sendPartialBinary as I was not interested in this method, but it likely does the samen

"From basic testing, it seems that calling it is still not complying", could you please elaborate?

With a spring test application backed by Jetty, we were having this problem where we could not send partial messages. After finding the awkward method ignoring the flag isPartial, we attempted to hot-fix the class, manually calling session.sendPartialText(message.getPayload(), message.isLast(), callback). We observed that jetty was still somewhere ignoring this flag, as we were receiving in the client two messages marked as final. Hence my question asking if the choice of Jetty message was intended.

In our test setup, we are trying to send a 40MB message - to force the chunking and usage of partial messages. Our code is created a first message of 30MB, marked as last = false and a second one of 10MB marked by our code as last = true. Inside jetty, as the message is too big for a single send, we observe that it is chunked into smaller pieces. The first message is chunked in multiple parts, the last part being marked as last, despite our original message saying otherwise.

That is also why my question is suggesting that this may be done on purpose, knowing that jetty implementation still does not support partial message, for some reason.

I completely understand that the above is mostly words. As you seem as puzzled as I am and you seem to think that it is a bug more than a feature, I will try to build a reproduction example in the coming day (after the new year festivities :tada: )

Cheers

Comment From: sdeleuze

@OPeyrusse Thanks, please provide a repro when you can.

Comment From: OPeyrusse

I will try to find time and do it

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.