[Libwebsockets] Acknowledgement on lws_write / LWS_WRITE_BINARY?

Andy Green andy at warmcat.com
Sat Sep 12 17:53:31 CEST 2020



On 9/12/20 4:48 PM, Duane Butler wrote:
> Hello,
> 
> We’re using libwebsockets 4.0 stable.
> 
> We are seeing cases where client LWS_WRITE_BINARY messages are not being 
> delivered due to unstable network connections and websocket closures in 
> the middle of pending writes.
> 
> Is there a way for a client application to know if a message was 
> actually delivered to the other side or not?

ws itself doesn't offer the concept of "transactions" in the same way 
as, eg, http does, with a "request" and then a "response" with an 
explicit code saying the disposition of the request.

If you want that, you have to add it into your ws subprotocol, eg, every 
outgoing ws message with your subprotocol has an incrementing ordinal or 
random token, and the peer will report back with an explicit disposition 
message listing which ones it saw and what the disposition was.

-Andy


More information about the Libwebsockets mailing list