@@ -5,14 +5,34 @@ This document describes how the __Browser Channel__ and the __WebSockets__ setti
5
5
This feature consists on:
6
6
7
7
* A route in the Flow Manager that serves as the entry point for clients: ` /browserChannel `
8
- * The component behind this route is the _ gpii.settingsHandlers.webSockets.component_
8
+ * The components behind this route are the _ gpii.flowManager.browserChannel.handler_
9
+ and the _ gpii.settingsHandlers.webSockets.component_
9
10
10
11
## The browser channel
11
12
12
- This handler processes every request to ` http ://localhost:8081/browserChannel` and is responsible for:
13
+ This handler processes every request to ` ws ://localhost:8081/browserChannel` and is responsible for:
13
14
14
15
* Processing every request and determining whether a client is allowed or not to connect
15
- * Registering and removing the clients as they are connecting or disconnecting
16
+ * Registering and removing the clients as they connect or disconnect.
17
+ * Processing modifications of settings that are caused by other aspects of the system, e.g. a new user logs in.
18
+
19
+ The browser channel handler supports the following request messages and sends the
20
+ associated responses. When an error occurs, the handler sends an response and
21
+ closes the web sockets connection.
22
+
23
+ * A client sends a connection request. In this example, the client is UIO+:
24
+ * request: ` {type: "connect", solutionId: "net.gpii.uioPlus"} `
25
+ * response: ` {type: "connectionSucceeded, "payload": {initial settings values for the solutionId}} `
26
+ * Client sends a request to change settings values:
27
+ * request: ` {type: "changeSettings", "payload": {settings values to change}} `
28
+ * response: ` {type: "changeSettingsReceived", "payload": {settings values after changing}} `
29
+ * Some other component of the system changes a setting relevant to connected clients:
30
+ * response: ` {type: "onChangeSettings", "payload:" {settings values after changing}} `
31
+ * Error response when connecting with an unknown solution:
32
+ * response: `{isError: true, message: "Rejecting a connection request from _ solutionId_ .
33
+ The solution id was not found in the solutions registry"}`
34
+ * Error response when trying to connect more than once:
35
+ * response: ` {isError: true, message: "Connection already established - cannot send a second connect message"} `
16
36
17
37
## The WebSockets settings handler
18
38
@@ -21,8 +41,7 @@ of the system. The settings handler is an instance of `gpii.settingsHandler.web
21
41
in _ gpii/node_modules/settingsHandlers/src/WebSocketsComponent.js_ .
22
42
23
43
This component stores the information about clients and keeps a list of settings for every solution that makes use of
24
- this settings handler. Also, this component create notifications for every connected client at any time when the
25
- settings change.
44
+ this settings handler. Also, this component notifies connected clients whenever their settings change.
26
45
27
46
## Usage
28
47
@@ -69,30 +88,34 @@ The workflow between the client and server can be summarised as follows:
69
88
the * id* of the client, in this instance ` net.gpii.uioPlus ` .
70
89
* The client will be registered if the solution's id can be found of the solutions registry, otherwise, the registration
71
90
will be rejected and the system will emit en error, and the client will disconnect.
72
- * When the flow manager emits either the _ connectionSucceeded _ (after being registered) or the _ onSettingsChanged _
73
- (after a user login/logout) signal to the client, it is delivering the current available settings for the client in
74
- the following way:
75
-
91
+ * The client can request changes to its settings by sending a _ changeSettings _ message type. If successful, the client
92
+ is sent a _ changeSettingsReceived _ message type.
93
+ * When a _ connectionSucceeded _ , _ changeSettingsReceived _ , or an _ onSettingsChanged _ signal is sent to the client, the
94
+ current available settings for the client are sent as well, e.g.:
76
95
``` json
77
96
{
78
- "screenReaderTTS/enabled" :false ,
79
- "highContrast/enabled" :true ,
80
- "invertColours" :false ,
81
- "magnifierEnabled" :true ,
82
- "magnification" :2 ,
83
- "fontSize" :" medium" ,
84
- "simplifier" :false ,
85
- "highContrastTheme" :" white-black"
97
+ "characterSpace" :1 ,
98
+ "clickToSelectEnabled" :false ,
99
+ "contrastTheme" :" wb" ,
100
+ "fontSize" :1.1 ,
101
+ "inputsLargerEnabled" :false ,
102
+ "lineSpace" :1 ,
103
+ "selectionTheme" :" default" ,
104
+ "selfVoicingEnabled" :false ,
105
+ "simplifiedUiEnabled" :false ,
106
+ "syllabificationEnabled" :false ,
107
+ "tableOfContentsEnabled" :false ,
108
+ "wordSpace" :1
86
109
}
87
110
```
88
- * When a client disconnects, it'll be removed from the list of registered clients
111
+ * When a client disconnects, it is removed from the list of registered clients
89
112
90
113
## Running the sample client
91
114
92
- The client has been checked in to [../examples/browserChannelClient](../examples/browserChannelClient). To try it out, first
93
- start the GPII in the CloudBased browserChannel test configuration from the root of universal with
115
+ An example client is avaiable at [../examples/browserChannelClient](../examples/browserChannelClient). To try it out, first
116
+ start the GPII test configuration from the root of universal with
94
117
95
- node gpii.js gpii/configs gpii.config.cloudBased.production
118
+ npm start
96
119
97
120
Then start the client from [../examples/browserChannelClient](../examples/browserChannelClient) with
98
121
0 commit comments