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

Function waitWS

autobahn_test.go:101–115  ·  view source on GitHub ↗
(ctx context.Context, url string)

Source from the content-addressed store, hash-verified

99}
100
101func waitWS(ctx context.Context, url string) error {
102 ctx, cancel := context.WithTimeout(ctx, time.Second*5)
103 defer cancel()
104
105 for ctx.Err() == nil {
106 c, _, err := websocket.Dial(ctx, url, nil)
107 if err != nil {
108 continue
109 }
110 c.Close(websocket.StatusNormalClosure, "")
111 return nil
112 }
113
114 return ctx.Err()
115}
116
117func wstestServer(tb testing.TB, ctx context.Context) (url string, closeFn func() error, err error) {
118 defer errd.Wrap(&err, "failed to start autobahn wstest server")

Callers 1

TestAutobahnFunction · 0.85

Calls 2

DialFunction · 0.92
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…