MCPcopy
hub / github.com/gorilla/websocket / NewClient

Function NewClient

client.go:40–49  ·  view source on GitHub ↗

NewClient creates a new client connection using the given net connection. The URL u specifies the host and request URI. Use requestHeader to specify the origin (Origin), subprotocols (Sec-WebSocket-Protocol) and cookies (Cookie). Use the response.Header to get the selected subprotocol (Sec-WebSocket

(netConn net.Conn, u *url.URL, requestHeader http.Header, readBufSize, writeBufSize int)

Source from the content-addressed store, hash-verified

38//
39// Deprecated: Use Dialer instead.
40func NewClient(netConn net.Conn, u *url.URL, requestHeader http.Header, readBufSize, writeBufSize int) (c *Conn, response *http.Response, err error) {
41 d := Dialer{
42 ReadBufferSize: readBufSize,
43 WriteBufferSize: writeBufSize,
44 NetDial: func(net, addr string) (net.Conn, error) {
45 return netConn, nil
46 },
47 }
48 return d.Dial(u.String(), requestHeader)
49}
50
51// A Dialer contains options for connecting to WebSocket server.
52//

Callers

nothing calls this directly

Calls 2

DialMethod · 0.95
StringMethod · 0.80

Tested by

no test coverage detected