Jetty uses org.eclipse.jetty.websocket.common.BlockingWriteCallback to send messages over websocket. If the client is "slow" then this blocking write may experience hangs (see e.g. here https://github.com/eclipse/jetty.project/issues/272#issuecomment-290910610)
I have a successfull simulation of slow client using Jetty+Spring+Spring's Websocket Client.
I would like to "send and forget" websocket messages, so if client is slow (for whatever confirmation it tries to do), this does not affect resolution of BrokerWriteCallback. What would be the best way to achieve that with Jetty (configuration or source code edit?)
Present Jetty version 9.3.11.v20160721 used with Spring 4.3.3.
Jetty has slow server and slow client tests already.
There's no such thing as "send and forget", as that implies infinite buffering.
There are non-blocking send options, but it is strongly encouraged that you pay attention to the Futures
or Callbacks
to know if the local endpoint has successfully sent that message (or not).
Hint: don't send another message to a RemoteEndpoint if the prior one hasn't succeeded yet (you have network congestion decisions to deal with).
Failure to pay attention to the Futures
or Callbacks
will trigger memory errors (OOM).
See RemoteEndpoint
:
If all of this seems overwhelming, consider using one of the many libraries built on top of websocket to manage all of this.
I would encourage you to look at the open source project cometd.org