I think this should send a CloseMessage frame before closing the connection, rather than just sending an EOF as at the moment. I think s.ws.WriteMessage(websocket.CloseMessage, []byte{}) in the error handling part of readConsole would do this, but my go isn't good enough for me to be sure.