MCPcopy
hub / github.com/coder/websocket / Dial

Function Dial

ws_js.go:290–296  ·  view source on GitHub ↗

Dial creates a new WebSocket connection to the given url with the given options. The passed context bounds the maximum time spent waiting for the connection to open. The returned *http.Response is always nil or a mock. It's only in the signature to match the core API.

(ctx context.Context, url string, opts *DialOptions)

Source from the content-addressed store, hash-verified

288// The returned *http.Response is always nil or a mock. It's only in the signature
289// to match the core API.
290func Dial(ctx context.Context, url string, opts *DialOptions) (*Conn, *http.Response, error) {
291 c, resp, err := dial(ctx, url, opts)
292 if err != nil {
293 return nil, nil, fmt.Errorf("failed to WebSocket dial %q: %w", url, err)
294 }
295 return c, resp, nil
296}
297
298func dial(ctx context.Context, url string, opts *DialOptions) (*Conn, *http.Response, error) {
299 if opts == nil {

Callers

nothing calls this directly

Calls 1

dialFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…