Skip to content

Commit

Permalink
use wss instead of ws if tlcConfig is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
zkokelj committed Dec 11, 2024
1 parent e5fe097 commit 5a21d38
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/gethfork/node/rpcstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,24 @@ func (h *httpServer) start() error {
h.listener = listener
go h.server.Serve(listener)

// Determine the scheme for WebSockets based on TLS presence
if h.wsAllowed() {
url := fmt.Sprintf("ws://%v", listener.Addr())
scheme := "ws"
if h.tlsConfig != nil {
scheme = "wss"
}
url := fmt.Sprintf("%s://%v", scheme, listener.Addr())
if h.wsConfig.prefix != "" {
url += h.wsConfig.prefix
}
h.log.Info("WebSocket enabled", "url", url)
}
// if server is websocket only, return after logging

// If server is websocket only, return after logging
if !h.rpcAllowed() {
return nil
}

// Log http endpoint.
h.log.Info("HTTP server started",
"endpoint", listener.Addr(), "auth", (h.httpConfig.jwtSecret != nil),
Expand Down

0 comments on commit 5a21d38

Please sign in to comment.