API Docs - v3.0.2
Tested Siddhi Core version: 5.1.13
It could also support other Siddhi Core minor versions.
Sink
websocket (Sink)
A Siddhi application can be configured to publish events via the Websocket transport by adding the @Sink(type = 'websocket') annotation at the top of an event stream definition.
Syntax@sink(type="websocket", url="<STRING>", sub.protocol="<STRING>", headers="<STRING>", idle.timeout="<INT>", truststore.path="<STRING>", truststore.password="<STRING>", @map(...)))
QUERY PARAMETERS
Name | Description | Default Value | Possible Data Types | Optional | Dynamic |
---|---|---|---|---|---|
url | The URL of the remote endpoint. |
STRING | No | No | |
sub.protocol | The negotiable sub-protocol if server is asking for it. |
null | STRING | Yes | No |
headers | Any specific headers which need to send to the server. |
null | STRING | 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/client-truststore.jks | STRING | Yes | No |
truststore.password | The password for the truststore. A custom password can be specified if required. If no custom password is specified, then the system uses |
wso2carbon | STRING | Yes | No |
Examples EXAMPLE 1
@Sink(type = 'websocket', url = 'ws://localhost:8025/abc',
@map(type='xml'))
define stream Foo (attribute1 string, attribute2 int);
A sink of type 'websocket' has been defined.
All events arriving at Foo stream will be sent to the url ws://localhost:8025/abc where the websocket server resides.
websocket-server (Sink)
A Siddhi application can be configured to run as a websocket server by adding the @Sink(type = 'websocket-server') annotation at the top of an event stream definition.
Syntax@sink(type="websocket-server", host="<STRING>", port="<STRING>", sub.protocol="<STRING>", idle.timeout="<INT>", tls.enabled="<BOOL>", keystore.path="<STRING>", keystore.password="<STRING>", @map(...)))
QUERY PARAMETERS
Name | Description | Default Value | Possible Data Types | Optional | Dynamic |
---|---|---|---|---|---|
host | host of the WebSocket server |
STRING | No | No | |
port | port of the WebSocket server |
STRING | No | No | |
sub.protocol | Sub-Protocols which are allowed by the service. |
null | STRING | Yes | No |
idle.timeout | Idle timeout of the connection. If the idle.timeout = '-1' then the timer is disabled. |
-1 | INT | Yes | No |
tls.enabled | This parameter specifies whether a secure connection is enabled or not. When this parameter is set to |
false | BOOL | Yes | No |
keystore.path | The file path to the location of the keystore. If a custom keystore is not specified, then the system uses the default keystore file - wso2carbon.jks in the |
${carbon.home}/resources/security/wso2carbon.jks | STRING | Yes | No |
keystore.password | The password for the keystore. A custom password can be specified if required. If no custom password is specified, then the system uses |
wso2carbon | STRING | Yes | No |
Examples EXAMPLE 1
@Sink(type = 'websocket-server', host='localhost', port='9025',
@map(type='xml'))
define stream Foo (attribute1 string, attribute2 int);
A sink of type 'websocket-server' has been defined.
Clients can connect to ws://localhost:9025/abc. All events arriving at Foo stream will be sent to all the clients who got connected.
Source
websocket (Source)
A Siddhi application can be configured to receive events via the WebSocket by adding the @Source(type = 'websocket') annotation at the top of an event stream definition.
When this is defined the associated stream will receive events from the WebSocket server on the url defined in the system.
@source(type="websocket", url="<STRING>", sub.protocol="<STRING>", headers="<STRING>", idle.timeout="<INT>", truststore.path="<STRING>", truststore.password="<STRING>", @map(...)))
QUERY PARAMETERS
Name | Description | Default Value | Possible Data Types | Optional | Dynamic |
---|---|---|---|---|---|
url | The URL of the remote endpoint. |
STRING | No | No | |
sub.protocol | The negotiable sub-protocol if server is asking for it. |
null | STRING | Yes | No |
headers | Any specific headers which need to send to the server. |
null | STRING | 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/client-truststore.jks | STRING | Yes | No |
truststore.password | The password for the truststore. A custom password can be specified if required. If no custom password is specified, then the system uses |
wso2carbon | STRING | Yes | No |
Examples EXAMPLE 1
@Source(type = 'websocket', url = 'ws://localhost:8025/websockets/abc',
@map(type='xml'))
define stream Foo (attribute1 string, attribute2 int);
Under this configuration, events are received via the WebSocket server and they are passed to Foo
stream for processing.
websocket-server (Source)
A Siddhi application can be configured to receive events via the WebSocket by adding the @Source(type = 'websocket-server') annotation at the top of an event stream definition.
Syntax@source(type="websocket-server", host="<STRING>", port="<STRING>", sub.protocol="<STRING>", idle.timeout="<INT>", tls.enabled="<BOOL>", keystore.path="<STRING>", keystore.password="<STRING>", @map(...)))
QUERY PARAMETERS
Name | Description | Default Value | Possible Data Types | Optional | Dynamic |
---|---|---|---|---|---|
host | host of the WebSocket server |
STRING | No | No | |
port | port of the WebSocket server |
STRING | No | No | |
sub.protocol | Sub-Protocols which are allowed by the service. |
null | STRING | Yes | No |
idle.timeout | Idle timeout of the connection. If the idle.timeout = '-1' then the timer is disabled. |
-1 | INT | Yes | No |
tls.enabled | This parameter specifies whether a secure connection is enabled or not. When this parameter is set to |
false | BOOL | Yes | No |
keystore.path | The file path to the location of the keystore. If a custom keystore is not specified, then the system uses the default keystore file - wso2carbon.jks in the |
${carbon.home}/resources/security/wso2carbon.jks | STRING | Yes | No |
keystore.password | The password for the keystore. A custom password can be specified if required. If no custom password is specified, then the system uses |
wso2carbon | STRING | Yes | No |
Examples EXAMPLE 1
@Source(type = 'websocket-server', host='localhost', port='8025',
@map(type='xml'))
define stream Foo (attribute1 string, attribute2 int);
Under this configuration, events are received via the WebSocket server and they are passed to Foo
stream for processing.