func handleConnection()

in websocketserver/websocketserver.go [135:148]


func handleConnection(w http.ResponseWriter, r *http.Request) (*websocket.Conn, error) {
	var err error
	// Setting the same protocol received for the websocket connection
	respHeader := make(http.Header)
	respHeader.Add("Sec-WebSocket-Protocol", "webfilesync.gitlab.com")
	conn, err := upgrader.Upgrade(w, r, respHeader)

	if err != nil {
		logrus.Error("error upgrading connection: ", err)
		return nil, err
	}

	return conn, nil
}