On Thu, Nov 21, 2013 at 1:11 PM, Johan Compagner <jcompag...@servoy.com>wrote:
> > > > Hi, > > > > > https://javaee-spec.java.net/nonav/javadocs/javax/websocket/OnMessage.html > > > > if i read that, then if i have > > > > onmessage(String) > > > > that i get the whole message as once. > > > > Where is it really specified that that also means that it must also fit > in > > the input buffer? > > So it can't be a partial at all? > > > > For me the difference between this: > > > > > > onmessage(String msg) > > onmessage(String msg,boolean lastPart) > > > > means that i do the streaming my self.. So i take the parts that are > > there, store it, save it whatever i want. So that only the buffer size is > > kept in memory (so it is really streaming) > > > > If i don't do that "lastPart" that just means that i want the whole > > message as once, no matter how it it send to the server, or better said, > > how it is handled by tomcat (or what ever webserver) internally , how big > > input buffers the webserver uses. > > > > For example tomcat uses by default 8KB. If i know that all my messages > are > > smaller then that, then i wouldn't do that lastPart boolean. But then my > > application is deployed on something else, that has a input buffer size > of > > 4KB and my message doesn't fit in there. Now i suddenly have to do the > > partial myself, and my app is broken > > This doesn't look right to me.. Because now it really looks to me that > all > > apps should include always that boolean param.. Because how do you know? > Or > > you must be really sure that the message are not passing a buffer > boundary > > (but maybe an implementation uses 256 bytes) > > > > -- > > Johan Compagner > > Servoy > > > > > To follow up on this a little bit > > this one: > > onmessage(Reader reader) > > only works also on the "whole" message > that is weird because you don't have i think really this support: > > onmessage(Reader reader, boolean lastPart) (at least that is not specified > here: > https://javaee-spec.java.net/nonav/javadocs/javax/websocket/OnMessage.html > ) > > But in a reader that sounds just weird, the reader should just block until > all parts are feeded to the reader.. > But that also doesn't work it fails. > So what is really the point of the reader param in this scenario? > Without being part of JSR 356 EG, the rationale of the cited APIs can be observed at protocol fragmentation support [1]. The point is that you may have cases where you need parts of message transferred and not the entire one. [1] http://tools.ietf.org/html/rfc6455#section-5.4 > > > -- > Johan Compagner > Servoy >