MCPcopy
hub / github.com/olahol/melody / main

Function main

examples/chat-echo/main.go:10–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8)
9
10func main() {
11 e := echo.New()
12 m := melody.New()
13
14 e.Use(middleware.Logger())
15 e.Use(middleware.Recover())
16
17 e.GET("/", func(c echo.Context) error {
18 http.ServeFile(c.Response().Writer, c.Request(), "index.html")
19 return nil
20 })
21
22 e.GET("/ws", func(c echo.Context) error {
23 m.HandleRequest(c.Response().Writer, c.Request())
24 return nil
25 })
26
27 m.HandleMessage(func(s *melody.Session, msg []byte) {
28 m.Broadcast(msg)
29 })
30
31 e.Logger.Fatal(e.Start(":5000"))
32}

Callers

nothing calls this directly

Calls 4

NewFunction · 0.92
HandleRequestMethod · 0.80
HandleMessageMethod · 0.80
BroadcastMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…