func setDeadlines(ws *websocket.Conn) { if err := ws.SetDeadline(time.Now().Add(100 * time.Hour)); err != nil { log.Fatal(err) } if err := ws.SetReadDeadline(time.Now().Add(100 * time.Hour)); err != nil { log.Fatal(err) } if err := ws.SetWriteDeadline(time.Now().Add(100 * time.Hour)); err != nil { log.Fatal(err) } }
/* handleAuthOk requests a subscription to console log messages after an "auth ok" has been received */ func handleAuthOk(ws *websocket.Conn) error { /* Set write timeout */ if err := ws.SetWriteDeadline(time.Now().Add(wto)); nil != err { return err } /* Ask to subscribe */ if _, err := ws.Write([]byte( "subscribe user:"******"/console", )); nil != err { return err } return nil }