Looking for the plugin's configuration parameters? You can find them in the WebSocket Validator configuration reference doc.
Validate individual WebSocket messages against to a user-specified schema before proxying them.
Message schema can be configured by type (text or binary) and sender (client or upstream).
When an incoming message is invalid according to the schema, a close frame is
sent to the sender (status: 1007
) and the peer before closing the
connection.
Usage
Note: Currently, the only supported validation type is JSON schema draft4, so all examples will use this.
At least one of the following complete message validation configurations must be defined:
-
config.client.text.type
andconfig.client.text.schema
-
config.client.binary.type
andconfig.client.binary.schema
-
config.upstream.text.type
andconfig.upstream.text.schema
-
config.upstream.binary.type
andconfig.upstream.binary.schema
Validate client text frames
This example validates that client text frames:
- Are valid JSON
- Are a JSON object (
{}
) - Have a
name
attribute (of any type)
Here’s an example sequence for this configuration: