isWebSocketFilter is the dedicated selector for WebSocket exchanges in a Fluxzy rule. It looks at the standard HTTP Upgrade handshake and matches every session that asks to be promoted to the WebSocket protocol. Use it whenever you need to act on bidirectional channels and leave regular request and response traffic untouched.
Reach for isWebSocketFilter when a rule should only apply to WebSocket sessions, identified by the standard Upgrade: websocket handshake. WebSockets behave quite differently from plain request and response exchanges, so isolating them in your rule pipeline keeps things predictable.
Typical situations:
The filter evaluates on the requestHeaderReceivedFromClient scope, so the Upgrade header is already parsed when it fires. Combine it with hostFilter or pathFilter if you only care about WebSocket traffic to a specific endpoint.
Apply a tag to all WS sessions so they stand out in the Fluxzy UI and can be filtered later for review.
rules:
- filter:
typeKind: IsWebSocketFilter
actions:
- typeKind: ApplyTagAction
tag:
value: websocket
Append the URL of each opened WS channel to a dedicated log file so you can audit which endpoints clients connect to.
rules:
- filter:
typeKind: IsWebSocketFilter
actions:
- typeKind: FileAppendAction
filename: /var/log/fluxzy/ws-channels.log
text: "{{exchange.url}}"
Block new WS sessions targeting a specific host while letting its regular HTTP endpoints continue to work. Useful when you want to disable a real time feature temporarily.
rules:
- filter:
typeKind: FilterCollection
children:
- typeKind: IsWebSocketFilter
- typeKind: HostFilter
pattern: realtime.example.com
actions:
- typeKind: RejectWithStatusCodeAction
statusCode: 403
Select websocket exchange.
Evaluation scope defines the timing where this filter will be applied.
requestHeaderReceivedFromClient This scope occurs the moment fluxzy parsed the request header receiveid from client
isWebSocketFilter
This filter has no specific characteristic
The following table describes the customizable properties available for this filter:
| Property | Type | Description | DefaultValue |
|---|---|---|---|
| inverted | boolean | Negate the filter result | false |
The following examples apply a comment to the filtered exchange
Select websocket exchange.
rules:
- filter:
typeKind: IsWebSocketFilter
actions:
- typeKind: ApplyCommentAction
comment: filter was applied
View definition of IsWebSocketFilter for .NET integration.
This filter has no related filter
It checks the request Upgrade header. Any value of websocket triggers a match. The Connection header and the Sec-WebSocket-Key are not required, although a real client always sends them.
Yes. wss is a WebSocket session inside a TLS tunnel. The filter matches on the Upgrade handshake regardless of whether the transport is plain or encrypted. Combine with isSecureFilter to distinguish.
Yes. Set inverted: true to select every regular HTTP exchange that is not a WebSocket upgrade.
Not directly. isWebSocketFilter only selects the session. To capture and review individual frames use captureSessionAction or one of the inspection features in the Fluxzy UI.