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

Function echoServer

conn_test.go:670–681  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request, opts *websocket.AcceptOptions)

Source from the content-addressed store, hash-verified

668}
669
670func echoServer(w http.ResponseWriter, r *http.Request, opts *websocket.AcceptOptions) (err error) {
671 defer errd.Wrap(&err, "echo server failed")
672
673 c, err := websocket.Accept(w, r, opts)
674 if err != nil {
675 return err
676 }
677 defer c.Close(websocket.StatusInternalError, "")
678
679 err = wstest.EchoLoop(r.Context(), c)
680 return assertCloseStatus(websocket.StatusNormalClosure, err)
681}
682
683func assertEcho(tb testing.TB, ctx context.Context, c *websocket.Conn) {
684 exp := xrand.String(xrand.Int(131072))

Callers 2

TestWasmFunction · 0.70
TestDialViaProxyFunction · 0.70

Calls 5

WrapFunction · 0.92
AcceptFunction · 0.92
EchoLoopFunction · 0.92
assertCloseStatusFunction · 0.70
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…