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

Function Dial

dial.go:120–122  ·  view source on GitHub ↗

Dial performs a WebSocket handshake on url. The response is the WebSocket handshake response from the server. You never need to close resp.Body yourself. If an error occurs, the returned response may be non nil. However, you can only read the first 1024 bytes of the body. This function requires a

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

Source from the content-addressed store, hash-verified

118//
119// URLs with http/https schemes will work and are interpreted as ws/wss.
120func Dial(ctx context.Context, u string, opts *DialOptions) (*Conn, *http.Response, error) {
121 return dial(ctx, u, opts, nil)
122}
123
124func dial(ctx context.Context, urls string, opts *DialOptions, rand io.Reader) (_ *Conn, _ *http.Response, err error) {
125 defer errd.Wrap(&err, "failed to WebSocket dial")

Callers 15

ExampleDialFunction · 0.92
ExampleCloseStatusFunction · 0.92
ExampleConn_PingFunction · 0.92
TestAutobahnFunction · 0.92
waitWSFunction · 0.92
wstestCaseCountFunction · 0.92
TestWasmFunction · 0.92
TestWasmDialTimeoutFunction · 0.92
TestBadDialsFunction · 0.92
Test_verifyHostOverrideFunction · 0.92
TestDialRedirectFunction · 0.92
TestDialViaProxyFunction · 0.92

Calls 1

dialFunction · 0.70

Tested by 15

ExampleDialFunction · 0.74
ExampleCloseStatusFunction · 0.74
ExampleConn_PingFunction · 0.74
TestAutobahnFunction · 0.74
waitWSFunction · 0.74
wstestCaseCountFunction · 0.74
TestWasmFunction · 0.74
TestWasmDialTimeoutFunction · 0.74
TestBadDialsFunction · 0.74
Test_verifyHostOverrideFunction · 0.74
TestDialRedirectFunction · 0.74
TestDialViaProxyFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…