Created
September 10, 2022 07:17
-
-
Save percybolmer/f35b54e5b444f7c4a89a2a9453972cc3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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