Description:

Acts as a WebSocket client endpoint to interact with a remote WebSocket server. FlowFiles are transferred to downstream relationships according to received message types as WebSocket client configured with this processor receives messages from remote WebSocket server.

Tags:

subscribe, WebSocket, consume, listen

Properties:

In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values.

Name Default Value Allowable Values Description
WebSocket Client ControllerService Controller Service API: WebSocketClientService Implementation: JettyWebSocketClient A WebSocket CLIENT Controller Service which can connect to a WebSocket server.
WebSocket Client Id The client ID to identify WebSocket session. It should be unique within the WebSocket Client Controller Service. Otherwise, it throws WebSocketConfigurationException when it gets started.

Relationships:

Name Description
text message The WebSocket text message output
binary message The WebSocket binary message output
connected The WebSocket session is established

Reads Attributes:

None specified.

Writes Attributes:

Name Description
websocket.controller.service.id WebSocket Controller Service id.
websocket.session.id Established WebSocket session id.
websocket.endpoint.id WebSocket endpoint id.
websocket.local.address WebSocket client address.
websocket.remote.address WebSocket server address.
websocket.message.type TEXT or BINARY.

State management:

This component does not store state.

How to configure?

Step 1: Drag and drop the ConnectWebSocket processor to canvas.

Step 2: Double click the processor to configure. The configuration dialog will be opened as follows:

properties

Step 3: Check the usage of each property and update those values.

Properties and usage:

WebSocket Client ControllerService: Used to specify the WebSocket client controller service which can connect to a WebSocket server.

WebSocket Client Id: Used to specify the client ID to identify WebSocket session. It should be unique within the WebSocket client controller service.

For example, to create a WebSocket client to the URI ws://echo.websocket.org then configure ConnectWebSocket processor as follows:

Client id: client-demo

sample

WebSocket client controller service

sample