MCPcopy Create free account
hub / github.com/adalkiran/distributed-inference / NewHttpServer

Function NewHttpServer

signaling/src/signaling/httpserver.go:31–44  ·  view source on GitHub ↗
(httpServerAddr string, wsCommandFnRegistry map[string]WsCommandFn)

Source from the content-addressed store, hash-verified

29}
30
31func NewHttpServer(httpServerAddr string, wsCommandFnRegistry map[string]WsCommandFn) (*HttpServer, error) {
32 wsHub := newWsHub(wsCommandFnRegistry)
33
34 httpServer := &HttpServer{
35 HttpServerAddr: httpServerAddr,
36 WsHub: wsHub,
37 }
38 http.HandleFunc("/", httpServer.serveHome)
39 http.HandleFunc("/ws", func(w http.ResponseWriter, r *http.Request) {
40 httpServer.serveWs(w, r)
41 })
42
43 return httpServer, nil
44}
45
46func (s *HttpServer) Run(waitGroup *sync.WaitGroup) {
47 defer waitGroup.Done()

Callers

nothing calls this directly

Calls 2

serveWsMethod · 0.95
newWsHubFunction · 0.85

Tested by

no test coverage detected