Skip to content
35 changes: 35 additions & 0 deletions docs/cep/sink/sink-types/websocket-server.md
Original file line number Diff line number Diff line change
@@ -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.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StoyanTc Does the URL have to be this specific value (ws://localhost:9025/abc)? Or do we need to provide more specific instructions for connecting?


## Syntax

```sql
CREATE SINK <NAME> WITH (type="websocket-server", map.type="<STRING>", host="<STRING>", port="<STRING>", sub.protocol="<STRING>", idle.timeout="<INT>", tls.enabled="<BOOL>", keystore.path="<STRING>", keystore.password="<STRING>"))
```

## 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 <NAME> WITH (type = 'websocket-server', map.type='json', host='localhost', port='8025')

CREATE STREAM example (attribute1 string, attribute2 int);
```
34 changes: 34 additions & 0 deletions docs/cep/sink/sink-types/websocket.md
Original file line number Diff line number Diff line change
@@ -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 <NAME> WITH (type="websocket", url="<SERVER URL>", map.type="<STRING>", sub.protocol="<STRING>", headers="<STRING>", idle.timeout="<INT>", truststore.path="<STRING>", truststore.password="<STRING>"))
```

## 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 <NAME> WITH (type='websocket', url ='ws://localhost:8025/websockets/abc', map.type='json')

CREATE STREAM example (attribute1 string, attribute2 int);
```
31 changes: 31 additions & 0 deletions docs/cep/source/source-types/websocket-server.md
Original file line number Diff line number Diff line change
@@ -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 <NAME> WITH (type="websocket-server", map.type="<STRING>", host="<STRING>", port="<STRING>", sub.protocol="<STRING>", idle.timeout="<INT>", tls.enabled="<BOOL>", keystore.path="<STRING>", keystore.password="<STRING>"))
```

## 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 <NAME> WITH (type='websocket-server', map.type='json', host='localhost', port='8025')

CREATE STREAM example (attribute1 string, attribute2 int);
```
34 changes: 34 additions & 0 deletions docs/cep/source/source-types/websocket.md
Original file line number Diff line number Diff line change
@@ -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 <NAME> WITH (type="websocket", url="<SERVER URL>", map.type="<STRING>", sub.protocol="<STRING>", headers="<STRING>", idle.timeout="<INT>", truststore.path="<STRING>", truststore.password="<STRING>"))
```


## 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 <NAME> WITH (type='websocket', url ='ws://localhost:8025/websockets/abc', map.type='json')

CREATE STREAM example (attribute1 string, attribute2 int);
```