NFIBrokerage / slipstream

A slick WebSocket client for Phoenix Channels
https://hex.pm/packages/slipstream
Apache License 2.0
160 stars 18 forks source link

Question about `push/4` docs #63

Closed nathanl closed 6 months ago

nathanl commented 6 months ago

I have been tinkering to see if a successful return value for push/4 implies any kind of network ack. I wondered - does it mean that my channel process on the other end has the message in its inbox?

The answer is "no". In my testing, if I'm pushing to a remote server, push/4 returns {:ok, ref} even if I've turned off WiFi (as long as I use heartbeat_interval_msec: 0 so that Slipstream doesn't notice that the connection is down).

The docs say

push/4 blocks until the message has been sent by the transport.

which in hindsight, is fairly clear that no TCP ack is implied. But I wonder: would it be better to say something like "until the message has been accepted by the OS network stack for sending"?

the-mikedavis commented 6 months ago

push/4 is ultimately gen_tcp:send/2 (or ssl:send/2 depending on the connection) which is a non-blocking send as the Erlang docs put it. We could add some more docs to push/4 that are clearer about that behavior - would you like to submit a PR?