diff --git a/docs/cep/sink/sink-types/websocket-server.md b/docs/cep/sink/sink-types/websocket-server.md new file mode 100644 index 0000000000..9cd6d69656 --- /dev/null +++ b/docs/cep/sink/sink-types/websocket-server.md @@ -0,0 +1,35 @@ +--- +title: websocket-server +--- + +The [WebSocket sink](websocket.md) sends events through the server which are then passed to the `example` stream. All events received by `example` stream are then sent to the WebSocket server + +Clients can connect to `ws://localhost:9025/abc` to receive events from the stream. + +## Syntax + +```sql +CREATE SINK WITH (type="websocket-server", map.type="", host="", port="", sub.protocol="", idle.timeout="", tls.enabled="", keystore.path="", keystore.password="")) +``` + +## Query Parameters + + +| Name | Description | Default Value | Possible Data Types | Optional | Dynamic | +|------|------------------|---------------|---------------------|----------|---------| +| host | Host name for the WebSocket server. | - | STRING | No | No | +| port | Port number for the WebSocket server. | - | STRING | No | No | +| sub.protocol | Sub-Protocols which are allowed by the service. Use format `subprotocol1, subprotocol2,...` | `null` | STRING | Yes | No | +| idle.timeout | `-1` | INT | Yes | No | +| tls.enabled | `false` | BOOL | Yes | No | +| keystore.path | `${carbon.home}/resources/security/wso2carbon.jks` | STRING | Yes | No | +| keystore.password | `wso2carbon` | STRING | Yes | No | + + +## Example + +```sql +CREATE SINK WITH (type = 'websocket-server', map.type='json', host='localhost', port='8025') + +CREATE STREAM example (attribute1 string, attribute2 int); +``` diff --git a/docs/cep/sink/sink-types/websocket.md b/docs/cep/sink/sink-types/websocket.md new file mode 100644 index 0000000000..9e9c825c51 --- /dev/null +++ b/docs/cep/sink/sink-types/websocket.md @@ -0,0 +1,34 @@ +--- +title: websocket +--- + +The WebSocket sink sends events to be processed by Macrometa from a topic in a [WebSocket server](websocket-server.md). + +All events delivered to `example` stream are also sent to the WebSocket server. + +Configure the server before using the following procedure. + +## Syntax + +```sql +CREATE SINK WITH (type="websocket", url="", map.type="", sub.protocol="", headers="", idle.timeout="", truststore.path="", truststore.password="")) +``` + +## Query Parameters + +| Name | Description | Default Value | Possible Data Types | Optional | Dynamic | +|------|------------------|---------------|---------------------|----------|---------| +| url | The URL of the remote endpoint. Must be `ws` or `wss`. | - | STRING | No | No | +| sub.protocol | The negotiable sub-protocol if required by server. Use format `subprotocol1, subprotocol2,...` | `null` | STRING | Yes | No | +| headers | Any specific headers which need to send to the server. Use format `'key1:value1', 'key2:value2',...` | `null` | Yes | No | +| idle.timeout | Idle timeout of the connection | `-1` | INT | Yes | No | +| truststore.path | The file path to the location of the truststore. If a custom truststore is not specified, then the system uses the default truststore file - wso2carbon.jks in the `${carbon.home}/resources/security` directory. | `${carbon.home}/resources/security/client-truststore.jks` | STRING | Yes | No | +| truststore.password | The password for the truststore. A custom password can be specified if required. | `wso2carbon` | STRING | Yes | No | + +## Example + +```sql +CREATE SINK WITH (type='websocket', url ='ws://localhost:8025/websockets/abc', map.type='json') + +CREATE STREAM example (attribute1 string, attribute2 int); +``` diff --git a/docs/cep/source/source-types/websocket-server.md b/docs/cep/source/source-types/websocket-server.md new file mode 100644 index 0000000000..506d5d1fbd --- /dev/null +++ b/docs/cep/source/source-types/websocket-server.md @@ -0,0 +1,31 @@ +--- +title: websocket-server +--- + +The [WebSocket source](websocket.md) receives events through the server which are then passed to the `example` stream for processing. + +## Syntax + +```sql +CREATE SOURCE WITH (type="websocket-server", map.type="", host="", port="", sub.protocol="", idle.timeout="", tls.enabled="", keystore.path="", keystore.password="")) +``` + +## Query Parameters + +| Name | Description | Default Value | Possible Data Types | Optional | Dynamic | +|------|------------------|---------------|---------------------|----------|---------| +| host | Host name for the WebSocket server. | - | STRING | No | No | +| port | Port number for the WebSocket server. | - | STRING | No | No | +| sub.protocol | Sub-Protocols which are allowed by the service. Use format `subprotocol1, subprotocol2,...` | `null` | STRING | Yes | No | +| idle.timeout | `-1` | INT | Yes | No | +| tls.enabled | `false` | BOOL | Yes | No | +| keystore.path | `${carbon.home}/resources/security/wso2carbon.jks` | STRING | Yes | No | +| keystore.password | `wso2carbon` | STRING | Yes | No | + +## Example + +```sql +CREATE SOURCE WITH (type='websocket-server', map.type='json', host='localhost', port='8025') + +CREATE STREAM example (attribute1 string, attribute2 int); +``` diff --git a/docs/cep/source/source-types/websocket.md b/docs/cep/source/source-types/websocket.md new file mode 100644 index 0000000000..8d89d57bf7 --- /dev/null +++ b/docs/cep/source/source-types/websocket.md @@ -0,0 +1,34 @@ +--- +title: websocket +--- + +The WebSocket source receives events to be processed by Macrometa from a topic in a [WebSocket server](websocket-server.md). + +Configure the server before using the following procedure. + +## Syntax + +```sql +CREATE SOURCE WITH (type="websocket", url="", map.type="", sub.protocol="", headers="", idle.timeout="", truststore.path="", truststore.password="")) +``` + + +## Query Parameters + +| Name | Description | Default Value | Possible Data Types | Optional | Dynamic | +|------|------------------|---------------|---------------------|----------|---------| +| url | The URL of the remote endpoint. Must be `ws` or `wss`. | - | STRING | No | No | +| sub.protocol | The negotiable sub-protocol if required by server. Use format: `subprotocol1, subprotocol2,...` | null | STRING | Yes | No | +| headers | Any specific headers which need to send to the server. Use format: `'key1:value1', 'key2:value2',...` | Yes | No | +| idle.timeout | Idle timeout of the connection | `-1` | INT | Yes | No | +| truststore.path | The file path to the location of the truststore. If a custom truststore is not specified, then the system uses the default truststore file - wso2carbon.jks in the `${carbon.home}/resources/security` directory. | `${carbon.home}/resources/security/client-truststore.jks` | STRING | Yes | No | +| truststore.password | The password for the truststore. A custom password can be specified if required. | `wso2carbon` | STRING | Yes | No | + + +## Example + +```sql +CREATE SOURCE WITH (type='websocket', url ='ws://localhost:8025/websockets/abc', map.type='json') + +CREATE STREAM example (attribute1 string, attribute2 int); +```