lxd/migration/wsproto.go
func ProtoSend(ws *websocket.Conn, msg proto.Message) error {
	w, err := ws.NextWriter(websocket.BinaryMessage)
	if err != nil {
		return err
	}
	defer w.Close()

	data, err := proto.Marshal(msg)
	if err != nil {
		return err
	}

	err = shared.WriteAll(w, data)
	if err != nil {
		return err
	}

	return nil
}
func ProtoSend(ws *websocket.Conn, msg proto.Message) error {
	w, err := ws.NextWriter(websocket.BinaryMessage)
	if err != nil {
		return err
	}
	defer w.Close()

	data, err := proto.Marshal(msg)
	if err != nil {
		return err
	}

	err = shared.WriteAll(w, data)
	if err != nil {
		return err
	}

	return nil
}
// ProtoSend sends a protobuf message over a websocket