aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/site-docs/adoc/fragments/ct-websocket-io.adoc
blob: 8a19cdd328d119e2e45f086d04d8af36b6080da6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//
// ============LICENSE_START=======================================================
//  Copyright (C) 2016-2018 Ericsson. All rights reserved.
// ================================================================================
// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
// 
// SPDX-License-Identifier: CC-BY-4.0
// ============LICENSE_END=========================================================
//
// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
//

== Websocket (WS) IO

APEX supports the Websockets as input as well as output.
WS IO is supported by the APEX Websocket plugin.
This carrier technology does only support uni-directional communication.
APEX will not send events to a Websocket input and any event sent to a Websocket output will result in an error log.

The input can be configured as client (APEX connects to an existing Websocket server) or server (APEX starts a Websocket server).
The same applies to the output.
Input and output can both use a client or a server configuration, or separate configurations (input as client and output as server, input as server and output as client).
Each configuration should use its own dedicated port to avoid any communication loops.
The configuration of a Websocket client is the same for input and output.
The configuration of a Websocket server is the same for input and output.


=== Websocket Client

APEX will connect to a given Websocket server.
As input, it will receive events from the server but not send any events.
As output, it will send events to the server and any event received from the server will result in an error log.

[source%nowrap,json]
----
"carrierTechnologyParameters" : {
  "carrierTechnology" : "WEBSOCKET", <1>
  "parameterClassName" :
  "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters",
  "parameters" : {
    "host" : "localhost", <2>
    "port" : 42451 <3>
  }
}
----

<1> set Websocket as carrier technology
<2> the host name on which a Websocket server is running
<3> the port of that Websocket server



=== Websocket Server

APEX will start a Websocket server, which will accept any Websocket clients to connect.
As input, it will receive events from the server but not send any events.
As output, it will send events to the server and any event received from the server will result in an error log.

[source%nowrap,json]
----
"carrierTechnologyParameters" : {
  "carrierTechnology" : "WEBSOCKET", <1>
  "parameterClassName" :
  "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters",
  "parameters" : {
    "wsClient" : false, <2>
    "port"     : 42450 <3>
  }
}
----

<1> set Websocket as carrier technology
<2> disable client, so that APEX will start a Websocket server
<3> the port for the Websocket server APEX will start