diff --git a/dial.go b/dial.go index ff57065f6e89dbe0ac0f680bd2c5c0fe40144ad6..eee40dd4ee0f6dd90a2c0b39ef97fe226c17f2af 100644 --- a/dial.go +++ b/dial.go @@ -47,6 +47,9 @@ func dial(ctx context.Context, u string, opts DialOptions) (_ *Conn, _ *http.Res if opts.HTTPClient == nil { opts.HTTPClient = http.DefaultClient } + if opts.HTTPClient.Timeout > 0 { + return nil, nil, xerrors.Errorf("please use context for cancellation instead of http.Client.Timeout; see issue nhooyr.io/websocket#67") + } if opts.HTTPHeader == nil { opts.HTTPHeader = http.Header{} }