Wasm client pings the server every second
This prevents disconnects when the server is behind Nignx. Resolves #35.
This commit is contained in:
parent
75946b600b
commit
80be38128f
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user