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)
| 118 | // |
| 119 | // URLs with http/https schemes will work and are interpreted as ws/wss. |
| 120 | func Dial(ctx context.Context, u string, opts *DialOptions) (*Conn, *http.Response, error) { |
| 121 | return dial(ctx, u, opts, nil) |
| 122 | } |
| 123 | |
| 124 | func 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") |
searching dependent graphs…