go func() {
for {
err := conn.WriteControl(websocket.PingMessage, nil, time.Now().Add(time.Second*10))
if err != nil {
fmt.Println(err)
return
}
time.Sleep(time.Second * 2)
}
}()
//read messages from the client
for {
_, data, err := conn.ReadMessage()
if err != nil {
fmt.Println(err)
return
}
buffer <- data
}
I have the above code, the go routine checks to see if the connection is alive every 10 seconds if its not how do I signal to the parents function to return? conn.Readmessage blocks execution.