Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Created September 10, 2022 07:17
Show Gist options
  • Save percybolmer/f35b54e5b444f7c4a89a2a9453972cc3 to your computer and use it in GitHub Desktop.
Save percybolmer/f35b54e5b444f7c4a89a2a9453972cc3 to your computer and use it in GitHub Desktop.
var (
// pongWait is how long we will await a pong response from client
pongWait = 10 * time.Second
// pingInterval has to be less than pongWait, We cant multiply by 0.9 to get 90% of time
// Because that can make decimals, so instead *9 / 10 to get 90%
// The reason why it has to be less than PingRequency is becuase otherwise it will send a new Ping before getting response
pingInterval = (pongWait * 9) / 10
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment