func Dial(ctx context.Context, u string, opts *websocket.DialOptions) (*ClientProtocol, error) {
	if opts == nil {
		opts = &websocket.DialOptions{}
	}
	opts.Subprotocols = SupportedSubprotocols
	c, _, err := websocket.Dial(ctx, u, opts)
	if err != nil {
		return nil, err
	}
	p, err := NewClientProtocol(c)
	if err != nil {
		return nil, err
	}
	p.connOwned = true
	return p, nil
}
Dial wraps websocket.Dial and creates the ClientProtocol.
package v2
import (
	"context"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"sync"
	"nhooyr.io/websocket"
	"github.com/cloudevents/sdk-go/v2/binding"
	"github.com/cloudevents/sdk-go/v2/binding/format"
	"github.com/cloudevents/sdk-go/v2/binding/utils"
	"github.com/cloudevents/sdk-go/v2/protocol"
)
type ClientProtocol struct {
	conn *websocket.Conn
	format      format.Format
	messageType websocket.MessageType
	receiverLock sync.Mutex
	connOwned    bool  
}