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.
For example, here’s what it looks like when validating that client text frames:
- Are valid JSON
- Are a JSON object (
{})
- Have a
name attribute (of any type)
sequenceDiagram
autonumber
activate Client
activate Kong
Client->>Kong: text(`{ "name": "Alex" }`)
activate Upstream
Kong->>Upstream: text(`{ "name": "Alex" }`)
Client->>Kong: text(`{ "name": "Kiran" }`)
Kong->>Upstream: text(`{ "name": "Kiran" }`)
Client->>Kong: text(`{ "missing_name": true }`)
Kong->>Client: close(status=1007)
Kong->>Upstream: close()
deactivate Upstream
deactivate Kong
deactivate Client
The clients with the names Alex and Kiran pass validation, but when missing_name appears,
it’s considered invalid and the plugin sends a close frame.