Wiki source code of Websocket API Documentation (Event)
Version 32.1 by michaely on 2015/07/14 09:42
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{layout}} | ||
2 | {{layout-section ac:type="two_right_sidebar"}} | ||
3 | {{layout-cell}} | ||
4 | {{info}} | ||
5 | The information on this page applies to **iSymphony 3.2+**. | ||
6 | {{/info}} | ||
7 | |||
8 | = (% style="color: rgb(0,0,0);" %)Description(%%) = | ||
9 | |||
10 | The websocket API provides realtime events about the current state of the iSymphony server. External applications can utilize this API to integrate with the iSymphony server, by reacting to events pertaining to users, and call state. In conjunction with the CRM widget, this API can also be utilized to create custom widgets for the iSymphony client interface. | ||
11 | {{/layout-cell}} | ||
12 | |||
13 | {{layout-cell}} | ||
14 | {{panel title="On this page:"}} | ||
15 | |||
16 | |||
17 | {{toc maxLevel="2" indent="1"/}} | ||
18 | {{/panel}} | ||
19 | {{/layout-cell}} | ||
20 | {{/layout-section}} | ||
21 | |||
22 | {{layout-section ac:type="single"}} | ||
23 | {{layout-cell}} | ||
24 | |||
25 | |||
26 | = Connecting To The Websocket = | ||
27 | |||
28 | The following URL can be used to connect to the websocket event API: | ||
29 | |||
30 | {{code}} | ||
31 | ws://manager:manag3rpa55word@<hostname or ip of the iSymphony server>:58080/communication_manager/ws/event | ||
32 | {{/code}} | ||
33 | |||
34 | = Event Filtering = | ||
35 | |||
36 | The Event API allows connections to specify which events they want to receive from the websocket, by specifying property filters. | ||
37 | |||
38 | {{info}} | ||
39 | **Filters specify which events to filter in**, not filter out. | ||
40 | {{/info}} | ||
41 | |||
42 | == The Filter Message == | ||
43 | |||
44 | A message, with the following format, can be sent to the websocket, in order to set the current filters for the connection. | ||
45 | |||
46 | {{code language="js"}} | ||
47 | { | ||
48 | "type" : "filter", | ||
49 | "filters" : [ | ||
50 | {"property" : "<property name>" : "value" : "<filter value>"}, | ||
51 | {"property" : "<property name>" : "value" : "<filter value>"}, | ||
52 | ... | ||
53 | ] | ||
54 | } | ||
55 | {{/code}} | ||
56 | |||
57 | Where <property name> is the name of the property to filter, and <filter value> is the property value to filter on. Multiple property filters can be specified. | ||
58 | |||
59 | |||
60 | |||
61 | {{info}} | ||
62 | If an event does not contain a property specified in one of the filters, the event will not be received. | ||
63 | {{/info}} | ||
64 | |||
65 | == Filter Message Response == | ||
66 | |||
67 | When a filter message is sent, the websocket will respond with one of the following messages: | ||
68 | |||
69 | == Wildcard == | ||
70 | |||
71 | If you specify a value of **"*"** for a filter property value, the property filter will match on any value of the property. | ||
72 | |||
73 | == Examples == | ||
74 | |||
75 | The following filter will only allow events of type dial: | ||
76 | |||
77 | {{code language="js"}} | ||
78 | { | ||
79 | "type" : "filter", | ||
80 | "filters" : [ | ||
81 | {"property" : "type" : "value" : "dial"} | ||
82 | ] | ||
83 | } | ||
84 | {{/code}} | ||
85 | |||
86 | The following filter will only allow events of type login and logout: | ||
87 | |||
88 | {{code language="js"}} | ||
89 | { | ||
90 | "type" : "filter", | ||
91 | "filters" : [ | ||
92 | {"property" : "type" : "value" : "login"}, | ||
93 | {"property" : "type" : "value" : "logout"} | ||
94 | ] | ||
95 | } | ||
96 | {{/code}} | ||
97 | |||
98 | The following filter will only allow events of type login and logout, for user mikey. | ||
99 | |||
100 | {{code language="js"}} | ||
101 | { | ||
102 | "type" : "filter", | ||
103 | "filters" : [ | ||
104 | {"property" : "type" : "value" : "login"}, | ||
105 | {"property" : "type" : "value" : "logout"}, | ||
106 | {"property" : "username" : "value" : "mikey"} | ||
107 | ] | ||
108 | } | ||
109 | {{/code}} | ||
110 | |||
111 | The following filter will only allow events that reference a user: | ||
112 | |||
113 | {{code language="js"}} | ||
114 | { | ||
115 | "type" : "filter", | ||
116 | "filters" : [ | ||
117 | {"property" : "username" : "value" : "*"} | ||
118 | ] | ||
119 | } | ||
120 | {{/code}} | ||
121 | |||
122 | = REST Resources = | ||
123 | |||
124 | The Live API exposes several REST resources, that allow access to the current state of specific objects in the system. All current live resources are listed below. Details concerning each resource, and their actions, can be found within the individual resource documentation pages. | ||
125 | |||
126 | == Resource List == | ||
127 | |||
128 | |||
129 | |||
130 | {{children/}} | ||
131 | |||
132 | == Notes on Resource Documentation == | ||
133 | |||
134 | Due to the interdependent nature of resources in the system, the resource path information in the documentation is split into several sections. Paths in a specific section may relate to, or require, paths specified in other sections. | ||
135 | |||
136 | * **Root Resource Paths : **Specifies paths that can be used to access sets (multiple instances) of a resource, in relation to a parent resource. | ||
137 | * **Instance Resource Paths : **Specifies paths that can be used to access a specific instance of a resource. These paths require a **Root Resource Path**, in most cases, but not all. | ||
138 | * **Sub Resource Paths : **Specifies paths that provide access to the child resources, of a specific resource instance. These paths require an **Instance Resource Path.** | ||
139 | * **Action Paths: **Specifies paths that are used to perform actions on a specific resource instance. These paths require an **Instance Resource Path.** | ||
140 | |||
141 | \\ | ||
142 | {{/layout-cell}} | ||
143 | {{/layout-section}} | ||
144 | {{/layout}} |