This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Input WebSocket Event Adapter

The input WebSocket event adapter is used to receive events via a WebSocket. You can specify the URL of a WebSocket, so that WSO2 products can receive events from it. The input WebSocket event adapter supports XML, JSON, and text type mappings.

Configuring input WebSocket event adapter

You can configure the Input WebSocket event adapter either using the management console or a configuration file

Configure using the management console

Follow the instructions below to configure input WebSocket event adapter using the management console. This deploys the event adapter in the <PRODUCT_HOME>/

repository/deployment/server/inputeventadaptors/ directory.

  1. Log in to the product's management console and click Configure.
  2. Click Input Event Adaptors in the Event Processor Configs menu, and then click Add Input Event Adaptor.
  3. Enter details as shown in the below example. 

    create input WebSocket event adapter

  4. Click Add Event Adaptor.

Configure using a configuration file

Follow the steps below to specify an input WebSocket event adapter configuration using a configuration file.

  1. Create an XML file with the following WebSocket event adapter configurations. Input event adapter implementation must start with <inputEventAdaptor> as the root element.

    <inputEventAdaptor name="websocketInputAdaptor" statistics="disable" trace="disable" type="websocket" xmlns="http://wso2.org/carbon/eventadaptormanager">
    <property name="websocket.server.url">ws://localhost:9099</property>
    </inputEventAdaptor>
  2. Add the XML file to the <PRODUCT_HOME>/repository/deployment/server/inputeventadaptors/ directory. Since hot deployment is enabled, you can simply add/remove files to deploy/undeploy from the server. 

After an adapter is successfully added, it gets added to the list of adapters displayed under Event Processor Configs in the Configure menu of the product's management console. Click Edit to change its configuration and redeploy it. This opens an XML-based editor allowing you to edit the event adapter configurations from the UI.  Do your modifications and click Update. You can also delete it, enable/disable statistics or enable/disable tracing on it using the provided options in the UI.

Configuring input WebSocket event adapter message properties

The configured input WebSocket event adapters are used in event builders. With input event adapter message properties, event builders are able to extract data from the incoming events to build the event streams. Following are the specific message properties of the input WebSocket event adapter.

input WebSocket event adapter message properties

The message properties of the input WebSocket event adapter are described below.

PropertyDescription
Topic The topic that will be used to receive messages on the input WebSocket event adapter. This is optional. 
Input Mapping TypeThe incoming event type to be mapped. The input WebSocket event adapter supports XML, JSON, and text type mappings.