wsdial

package
v0.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package wsdial wraps the gorilla WebSocket handshake so a failure says what the peer actually answered.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(d *websocket.Dialer, rawURL string, hdr http.Header) (*websocket.Conn, error)

Dial performs the WebSocket handshake and, on failure, returns an error that identifies which hop rejected it.

gorilla answers every non-101 response with the same bare `websocket: bad handshake`, so the log line reads identically whether:

  • the application rejected it — 401 `{"error":"invalid sync token"}`
  • the route is not registered — 404, or 503 "sync not configured"
  • an ingress has no matching rule for this vhost/path — 404 from nginx
  • an edge proxy refuses upgrades outright — 403 from Envoy, and the request never reaches the application at all

The distinguishing evidence is already in the second return value gorilla hands back and was being discarded: the status, the `Server` header naming the hop that answered, and `X-AgentBox-Server-Version`, whose presence proves the request reached an AgentBox backend rather than dying in front of it.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL