Joakim, that's a really good explanation, everything makes sense now. Yes, I'm using streaming for both text and binary messages. FYI, I mentioned frames but really meant messages, I don't do any fragmentation in my protocol anyway.
On Wed, 10 Jan 2018 at 23:58 Joakim Erdfelt <[email protected]> wrote: > @OnWebSocketMessage is a Jetty API for whole message delivery of websocket > messages. > > The internals of Jetty will aggregate the individual frames and then call > your method with the entire message. > > For WebSocket frames access, don't use annotations, and instead use the > org.eclipse.jetty.websocket.api.WebSocketFrameListener. > > http://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/websocket/api/WebSocketFrameListener.html > > The only scenario where @OnWebSocketMessage method will be called from > different threads is if you are using a streaming based approach to > handling. > For each websocket message, the first frame will result in a dispatched > @OnWebSocketMessage to you. > Each dispatch will be on a new thread, this is to allow your websocket > application the opportunity to read the websocket message via the java.io > Stream APIs. > When the message is finished (fin=true frame received), then the final > payload is delivered to your prior dispatched thread and a new message is > allowed to be started. > > To avoid this dispatch, use String (for websocket TEXT messages) or > ByteBuffer (for websocket BINARY messages) object types in your > @OnWebSocketMessage method, not streams. > Those are delivered to your application's @OnWebSocketMessage in the same > thread as the one managing the reads operations from the internal websocket > connection. > > > Joakim Erdfelt / [email protected] > > On Wed, Jan 10, 2018 at 5:48 PM, coudy <[email protected]> wrote: > >> I'm trying to process WS frames in incoming order per socket and am a bit >> stuck. >> >> My `@OnWebSocketMessage` handler gets dispatched on various threads out of >> the Jetty server thread pool, which seems to be used for all manner of >> things, so I can't simply configure that to have one thread. >> >> As such it doesn't look like per-socket (per-session) threading is >> configurable. Since messaging ordering in WS is obviously derived from >> TCP's >> the lack of configurability is extremely surprising. I hope I'm just >> missing >> something. >> >> Many thanks for any pointers. >> >> >> >> -- >> Sent from: http://jetty.4.x6.nabble.com/Jetty-User-f3247280.html >> _______________________________________________ >> jetty-users mailing list >> [email protected] >> To change your delivery options, retrieve your password, or unsubscribe >> from this list, visit >> https://dev.eclipse.org/mailman/listinfo/jetty-users >> > > _______________________________________________ > jetty-users mailing list > [email protected] > To change your delivery options, retrieve your password, or unsubscribe > from this list, visit > https://dev.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________ jetty-users mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/jetty-users
