websocket-kit icon indicating copy to clipboard operation
websocket-kit copied to clipboard

Client should send ping

Open bridger opened this issue 6 years ago • 2 comments

Amazon's Application Load Balancers are configured to shut down connections that haven't had traffic.

Sending a ping on the connection every so often is enough to keep the connection alive. I plan to implement this functionality on the WebSocket class and will submit a PR.

bridger avatar Mar 01 '20 17:03 bridger

@bridger thanks. We automatically return a pong already for the server case but it looks like the client case needs to be sending ping at some interval. eventLoop.scheduledTask will probably work well for this.

tanner0101 avatar Mar 05 '20 20:03 tanner0101

@tanner0101 The scheduleTask API is what I used to address this issue in https://github.com/vapor/websocket-kit/pull/68

Sent with GitHawk

bridger avatar Mar 05 '20 21:03 bridger