Closed sinclairzx81 closed 5 hours ago
Closed due to radio silence on this issue.
Seems desirable. Reopening.
Spec issue: https://github.com/whatwg/websockets/issues/10
I discovered that ping/pong frames are sent automatically thanks to: #13172
But I had to set { idleTimeout: 30 }
on the call to Deno.upgradeWebSocket
to prevent nginx from killing the connection.
I am going to close this as we automatically ping-pong now.
Hi, Would it be possible to include the methods
.ping()
and.pong()
on Deno's Web Socket implementation? It's noted that while browsers do not support sending these control frames, they can be a server side requirement if deploying WebSocket servers behind load balanced environments.Infrastructure such as AWS's Application / Network Load Balancer (as well as many other load balancers) will automatically terminate idle connections. Applications can mitigate LB termination by periodically sending
ping()
control frames down to each connected client. Becauseping
frames are sent out of band from the sockets messaging channel, server applications can keep their connection keep alive logic and application protocol logic separate (with the added benefit of browser Web Sockets not seeingping
control frames at all)Without this functionality, it does raise quite a few challenges porting existing application protocols to run on Deno. This is due to applications often omitting ping control frames in the applications protocol itself (as it's generally understood that these control frames are already provided as part of the RFC6455 specification)
RFC
https://www.rfc-editor.org/rfc/rfc6455#section-5.5.2 https://www.rfc-editor.org/rfc/rfc6455#section-5.5.3
Rust
https://docs.rs/ws/latest/ws/struct.Frame.html#method.ping https://docs.rs/ws/latest/ws/struct.Frame.html#method.pong
Node
https://github.com/websockets/ws/blob/master/lib/sender.js#L209 https://github.com/websockets/ws/blob/master/lib/sender.js#L252
Would it be possible to include these methods?