Expose ping/pong mechanism for user integration #10
Labels
addition/proposal
New features or enhancements
needs implementer interest
Moving the issue forward requires implementers to express interest
In https://websockets.spec.whatwg.org/#ping-and-pong-frames, it says the following:
Prior discussion in https://www.w3.org/Bugs/Public/show_bug.cgi?id=13104 states ping/pong functionality is only meant to be a keepalive mechanism, but this interpretation is explicitly contradicted by the note in RFC 6455 section 5.5.2: (emphasis added)
There is some web dev need for active server responsiveness checks as well, and the usual workaround where the web dev controls both client and server is to use special data frames to implement that at a higher level, which is at best just wasteful and at worst just plainly wrong depending on the size of typical messages received.
Concretely, I have a suggestion: add a
responsivenessCheck: {issueAfter, timeout}
option for theWebSocket
constructor to implement this in a way that gives the web developer what they need and.responsivenessCheck.issueAfter
milliseconds of no data received from the underlying socket and must terminate the connection abnormally if no frame is received by at leastresponsivenessCheck.timeout
milliseconds.close
event should be fired against the web socket with astatus
of 1006, consistent with the existing spec's warning here, if no data has been received by the time the timeout triggers and the web socket is still open. (This extra condition avoids the race condition of timeout task schedule -> data/close received -> timeout task execute.)The idea here is to offer a mechanism that tracks connection responsiveness correctly, so users aren't having to hack their own (likely inadequate and/or inaccurate) versions of this for things like multiplayer games and real-time chat.
The text was updated successfully, but these errors were encountered: