WebSocket event receiver is an internal event receiver that comes with WSO2 products by default. You can configure it with XML, JSON, and text input mapping types.
websocket event receiver should be used when the event source is a websocket server to which the CEP server need to connect in order to receive events. However, if the event source is a websocket client, the event source should connect to the inbuilt web socket server of WSO2 CEP. In such scenarios, use the WebSocket Local Event Receiver.
Start the WebSocket server, before starting the event receiver configurations.
Creating a WebSocket event receiver
For instructions on creating a WebSocket event receiver, see Configuring Event Receivers.
Configuring adapter properties
Specify the Adapter Properties , when creating a WebSocket event receiver using the management console as shown below.
After entering the above adapter properties, select the Event Stream to which you want to map the incoming events, and the Message Format which you want to apply on the receiving events. Also, click Advanced to define custom input mappings based on the Message Format you selected. For more information on custom input mapping types, see Input Mapping Types .
You can also d efine the respective adapter properties of the event receiver based on the transport type within the
<from> element of the event receiver configuration in the
<PRODUCT_HOME>/repository/deployment/server/eventreceivers/ directory as follows.
The above adapter properties are described below.
|Configuration file property||Example|
|Web Socket Server URL||URL of the WebSocket server to which you want to connect to|
|Is events duplicated in cluster||In a cluster whether the same event can reach two receiver nodes|
For more information on
websocket event receiver type, see the following sample.