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

Function Accept

accept.go:102–104  ·  view source on GitHub ↗

Accept accepts a WebSocket handshake from a client and upgrades the connection to a WebSocket. Accept will not allow cross origin requests by default. See the InsecureSkipVerify and OriginPatterns options to allow cross origin requests. Accept will write a response to w on all errors. Note that u

(w http.ResponseWriter, r *http.Request, opts *AcceptOptions)

Source from the content-addressed store, hash-verified

100// Note that using the http.Request Context after Accept returns may lead to
101// unexpected behavior (see http.Hijacker).
102func Accept(w http.ResponseWriter, r *http.Request, opts *AcceptOptions) (*Conn, error) {
103 return accept(w, r, opts)
104}
105
106func accept(w http.ResponseWriter, r *http.Request, opts *AcceptOptions) (_ *Conn, err error) {
107 defer errd.Wrap(&err, "failed to accept WebSocket connection")

Callers 8

echoServerFunction · 0.92
ExampleAcceptFunction · 0.92
Example_writeOnlyFunction · 0.92
Example_crossOriginFunction · 0.92
echoServerFunction · 0.92
PipeFunction · 0.92
ServeHTTPMethod · 0.92
subscribeMethod · 0.92

Calls 1

acceptFunction · 0.85

Tested by 5

echoServerFunction · 0.74
ExampleAcceptFunction · 0.74
Example_writeOnlyFunction · 0.74
Example_crossOriginFunction · 0.74
echoServerFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…