Skip to content

Commit

Permalink
Merge pull request #1982 from dubek/fix-exporter-websocket-namespace
Browse files Browse the repository at this point in the history
contrib/exporters/core: Populate the X-Websocket-Namespace header
  • Loading branch information
nplanel authored Sep 9, 2019
2 parents 2bcd6c9 + 13a825b commit 4deef78
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion contrib/exporters/core/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package core

import (
"fmt"
"net/http"
"net/url"
"os"
"os/signal"
Expand All @@ -29,6 +30,7 @@ import (
"github.com/skydive-project/skydive/common"
"github.com/skydive-project/skydive/config"
shttp "github.com/skydive-project/skydive/http"
"github.com/skydive-project/skydive/logging"
"github.com/skydive-project/skydive/websocket"
)

Expand All @@ -55,7 +57,12 @@ func NewSubscriber(pipeline *Pipeline, cfg *viper.Viper) (*websocket.StructSpeak
namespace = namespace + "/" + captureID
}

wsClient, err := config.NewWSClient(common.AnalyzerService, subscriberURL, websocket.ClientOpts{AuthOpts: CfgAuthOpts(cfg)})
logging.GetLogger().Infof("Subscribing to %s with namespace '%s'", subscriberURL, namespace)
clientOpts := websocket.ClientOpts{
AuthOpts: CfgAuthOpts(cfg),
Headers: http.Header{"X-Websocket-Namespace": []string{namespace}},
}
wsClient, err := config.NewWSClient(common.AnalyzerService, subscriberURL, clientOpts)
if err != nil {
return nil, fmt.Errorf("Failed to create websocket client: %s", err)
}
Expand Down

0 comments on commit 4deef78

Please sign in to comment.