taoensso / sente

Realtime web comms library for Clojure/Script
https://www.taoensso.com/sente
Eclipse Public License 1.0
1.74k stars 193 forks source link

Calculate RTT for :chsk/ws-ping messages #272

Closed danielcompton closed 8 years ago

danielcompton commented 8 years ago

It would be helpful for monitoring to see the round trip time for ping's (ping from server to client and reply to server again) to detect when clients have slow connections or there are other network issues. I don't have a really concrete design in mind, but here are a few thoughts:

ptaoussanis commented 8 years ago

Hi Daniel,

Any particular reason you don't just take this measurement yourself, in the particular way you'd like + makes sense for your application? For example, just send a client->server request and measure the time to respond?

I.e. is there a reason this needs to be a part of Sente core?

danielcompton commented 8 years ago

Not particularly, other than that there's already a ping message being sent. Probably fine to be external to Sente though.

ptaoussanis commented 8 years ago

Complecting RTT with the ping could lead to trouble though, most obviously: the ping (by design) isn't always sent if there's been other connection activity.

Would also suggest that the number of (valid) design questions you insightfully raised might be an indication that RTT would better be left to application authors so that they can decide what fits best for their particular requirements. Does that make sense?

danielcompton commented 8 years ago

Yep, I had that thought too, when I thought more about when pings are sent.