IsWebSocket returns true if HTTP connection is WebSocket otherwise false.
()
| 191 | |
| 192 | // IsWebSocket returns true if HTTP connection is WebSocket otherwise false. |
| 193 | func (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 | |
| 199 | func isValidProto(proto string) bool { |
| 200 | if proto == "" { |