Wasm client pings the server every second

This prevents disconnects when the server is behind Nignx.  Resolves
#35.
This commit is contained in:
Zorchenhimer 2019-03-16 14:12:25 -04:00
parent 75946b600b
commit 80be38128f
2 changed files with 3 additions and 1 deletions

View File

@ -5,6 +5,7 @@ type ClientDataType int
const (
CdMessage ClientDataType = iota // a normal message from the client meant to be broadcast
CdUsers // get a list of users
CdPing // ping the server to keep the connection alive
)
type DataType int

View File

@ -261,6 +261,7 @@ func main() {
// This is needed so the goroutine does not end
for {
time.Sleep(time.Minute)
websocketSend("", common.CdPing)
time.Sleep(time.Second)
}
}