MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / waitConnected

Function waitConnected

internal/ws/handler_test.go:100–111  ·  view source on GitHub ↗

waitConnected polls the hub until the agent is registered or timeout.

(t *testing.T, hub *Hub, agentID string)

Source from the content-addressed store, hash-verified

98
99// waitConnected polls the hub until the agent is registered or timeout.
100func waitConnected(t *testing.T, hub *Hub, agentID string) {
101 t.Helper()
102 deadline := time.After(2 * time.Second)
103 for !hub.IsConnected(agentID) {
104 select {
105 case <-deadline:
106 t.Fatalf("timed out waiting for %s to register in hub", agentID)
107 default:
108 time.Sleep(10 * time.Millisecond)
109 }
110 }
111}
112
113// doHTTP does a plain HTTP GET (no upgrade) to the WS endpoint, sending the
114// credential (when non-empty) as an Authorization: Bearer header.

Calls 1

IsConnectedMethod · 0.80

Tested by

no test coverage detected