WebSocket Client
The WebSocket Client origin reads data from a WebSocket server endpoint. Use the origin to read data from a WebSocket resource URL.
When the pipeline starts, the WebSocket Client origin opens a connection to the WebSocket server endpoint and optionally sends an initial message to the server. The WebSocket server then pushes data to the WebSocket Client origin. The origin creates and sends a batch as soon as the data arrives. The size of each batch varies, based on the size of the data sent by the server endpoint. When the pipeline stops, the origin closes the connection to the endpoint.
When you configure the WebSocket Client origin, you define the resource URL and headers to use for the requests. You configure whether the origin uses no authentication or basic authentication to connect to the WebSocket server endpoint. You can also configure SSL/TLS properties, including default transport protocols and cipher suites.
Read REST Response Data from Data Collector
You can use the WebSocket Client origin to read REST response JSON data generated by Data Collector.
Data Collector can serve as a WebSocket server endpoint, as a WebSocket server is simply a TCP application listening on any port of a server that follows a specific protocol.
For example, let's say that your Data Collector runs twenty pipelines and you want to receive an email when any pipeline state changes to Run_Error. Instead of configuring email notifications for all twenty pipelines, you'd like to configure a single global email notification for all of the running pipelines.
- Add a WebSocket Client origin and configure the origin to read from the
following resource
URL:
ws://<Data Collector host>:<Data Collector port>/rest/v1/webSocket?type=status - Configure the origin to use basic authentication, and then enter a valid Data Collector username and password on the Credentials tab.
- On the Data Format tab, configure the origin to process the JSON data format.
- Add an Email executor to the canvas and connect it to the origin.
- On the Email tab of the executor, enter the following
condition so that the executor sends an email only when a pipeline state changes
to
Run_Error:
${record:value('/status') == 'RUN_ERROR'} - Configure the email IDs, subject, and body for the executor.
For more details about configuring the executor, see Email Executor. Before you run a pipeline that includes the Email executor, you must enable Data Collector to send email.
The configured pipeline looks like this:

Data Formats
The WebSocket Client origin processes data differently based on the data format that you select. The origin processes the following types of data:
- Binary
- Generates a record with a single byte array field at the root of the record.
- Datagram
- Generates a record for every message. The origin can process collectd messages, NetFlow 5 and NetFlow 9 messages, and the
following types of syslog messages:
- RFC 5424 (https://tools.ietf.org/html/rfc5424)
- RFC 3164 (https://tools.ietf.org/html/rfc3164)
- Non-standard common messages, such as RFC 3339 dates with no version digit
- Delimited
- Generates a record for each delimited line. You can use the
following delimited format types:
- Default CSV - File that includes comma-separated values. Ignores empty lines in the file.
- RFC4180 CSV - Comma-separated file that strictly follows RFC4180 guidelines.
- MS Excel CSV - Microsoft Excel comma-separated file.
- MySQL CSV - MySQL comma-separated file.
- PostgreSQL CSV - PostgreSQL comma-separated file.
- PostgreSQL Text - PostgreSQL text file.
- Tab-Separated Values - File that includes tab-separated values.
- Custom - File that uses user-defined delimiter, escape, and quote characters.
- JSON
- Generates a record for each JSON object. You can process JSON files that include multiple JSON objects or a single JSON array.
- Log
- Generates a record for every log line.
- Protobuf
- Generates a record for every protobuf message. By default, the origin assumes messages contain multiple protobuf messages.
- SDC Record
- Generates a record for every record. Use to process records generated by a Data Collector pipeline using the SDC Record data format.
- Text
- Generates a record for each line of text or for each section of text based on a custom delimiter.
- XML
- Generates records based on a user-defined delimiter element. Use an XML element directly under the root element or define a simplified XPath expression. If you do not define a delimiter element, the origin treats the XML file as a single record.
Configuring a WebSocket Client Origin
Configure a WebSocket Client origin to read data from a WebSocket server endpoint.