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

Method IsWebSocket

context.go:193–197  ·  view source on GitHub ↗

IsWebSocket returns true if HTTP connection is WebSocket otherwise false.

()

Source from the content-addressed store, hash-verified

191
192// IsWebSocket returns true if HTTP connection is WebSocket otherwise false.
193func (c *Context) IsWebSocket() bool {
194 upgrade := c.request.Header.Get(HeaderUpgrade)
195 connection := c.request.Header.Get(HeaderConnection)
196 return strings.EqualFold(upgrade, "websocket") && strings.Contains(strings.ToLower(connection), "upgrade")
197}
198
199func isValidProto(proto string) bool {
200 if proto == "" {

Callers 2

TestContext_IsWebSocketFunction · 0.80
ToMiddlewareMethod · 0.80

Calls 1

GetMethod · 0.45

Tested by 1

TestContext_IsWebSocketFunction · 0.64