MCPcopy Index your code
hub / github.com/labstack/echo / createSimpleWebSocketServer

Function createSimpleWebSocketServer

middleware/proxy_test.go:941–961  ·  view source on GitHub ↗
(serveTLS bool)

Source from the content-addressed store, hash-verified

939}
940
941func createSimpleWebSocketServer(serveTLS bool) *httptest.Server {
942 handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
943 wsHandler := func(conn *websocket.Conn) {
944 defer conn.Close()
945 for {
946 var msg string
947 err := websocket.Message.Receive(conn, &msg)
948 if err != nil {
949 return
950 }
951 // message back to the client
952 websocket.Message.Send(conn, msg)
953 }
954 }
955 websocket.Server{Handler: wsHandler}.ServeHTTP(w, r)
956 })
957 if serveTLS {
958 return httptest.NewTLSServer(handler)
959 }
960 return httptest.NewServer(handler)
961}
962
963func createSimpleProxyServer(t *testing.T, srv *httptest.Server, serveTLS bool, toTLS bool) *httptest.Server {
964 e := echo.New()

Calls 2

ServeHTTPMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…