A WebSocket allows the client to request data using SQL as input.
Use the following URL to open a WebSocket connection. Depending on deployment, use ws (not-secure) or wss (secure) connection:
Once the connection is established, the server expects the client to send a JSON message with the following structure:
The client should wait for incoming messages and stop when EOF is received. The server sends JSON-encoded messages, the payload structure is:
Since there are multiple types of messages the server sends, the type
attribute determines the data structure for the data
payload. Below is the list of possible type
values:
The data
the attribute is null. The client should ignore these messages.
In this case, the payload structure is:
When requested the payload format is:
A possible payload can be:
The payload format is:
The payload format is:
The payload format is:
The payload format is:
Given the type
RECORD the payloads contains the data returned to the client, and it is dependent on the SQL input. The payload format is:
For a topic which contains nested data for both key and value.
The payload format is:
If the Kafka message key is null the response would be:
Projecting the key will not return the key
attribute:
produces the following output:
Aggregating data will not return the key
and metadata
attributes: