Replies: 3 comments 3 replies
-
Ref ricea/websocketstream-explainer#10. In terms of modifying what we do regardless of spec: I'd be against breaking spec. The websocket returned by |
Beta Was this translation helpful? Give feedback.
-
I think it would be reasonable for us to automatically send ping frames every 30 seconds while the connection is open (maybe customizable using options in FYI the client side |
Beta Was this translation helpful? Give feedback.
-
Since the version 0.118.0 of
deno_std
,ws
module was removed. The documentation says to useDeno.upgradeWebSocket()
API instead. This function returns{ response: Response, socket: WebSocket }
whereWebSocket
is a type that, as I understand, the authors of Deno aim to use both for client-side and server-side WebSockets.The
WebSocket
class in Deno has been implemented in accordance with W3C WebSocket API, which is the standard meant primarily for browsers. It is unfortunate that the control over ping/pong frames is not exposed through this API. Browsers do not provide to the scripts they run any means to deliberately send ping frames to the server, or to detect incoming pings. Thankfully, browsers, as well as all conforming implementations at least automatically respond to pings when the other party sends them.It is then crucial that the other party—server—has control over ping/pong frames. This control is necessary for latency instrumentation, maintaining of NAT mappings and timely detection of broken connections (example from ws, a node.js library). Contrary to what some may believe, TCP just by itself does not provide these features. Broken TCP connections can be present for a very long time without any notification to the other party!
My question is whether the authors of Deno consider it feasible to add methods to send ping/pong frames and events to act upon their receipt to the
WebSocket
class.Beta Was this translation helpful? Give feedback.
All reactions