Hi there,
I recently started to work on a WebSocket JSR implementation and noticed an issue I would like to bring up for discussion.
MessageHandler.Async should be used to act on "fragments" for TEXT and BINARY frames. For TEXT frames the actual payload is of the type String.
I think here is a problem... From my understanding it is completely valid to "split" TEXT frames in fragments even on invalid code points (UTF8). So when done so this will result in an invalid String that does not reflect the actual send payload once the Strings are assembled later.
The web socket RFC[1] states only "complete" WebSocket frames must be valid UTF8. This is the reason why can only "convert" them to a String once you received the complete one.
So to fix this even for TEXT frames the payload type should be ByteBuffer. But here comes the next problem as the API uses the payload type to detect which frame types the MessageHandler.Async handles.
Cheers,
Norman
[1]
http://tools.ietf.org/html/rfc6455#section-5.6
---
Norman Maurer
nmaurer_at_redhat.com
JBoss, by Red Hat