Skip to content

Commit cb073d8

Browse files
committed
Finished documentation of Error Generation feature #8
1 parent 4b8d9c8 commit cb073d8

3 files changed

Lines changed: 52 additions & 29 deletions

File tree

README.md

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Look in the example folder for a comprehensive set of code examples covering the
2121

2222
## Note About Terminology
2323

24-
Please note that within this library **resource names**, as defined in
25-
the WebSocket protocol specification, are referred to as **services**.
24+
Please note that within this library **"resource names"**, as defined in
25+
the WebSocket protocol specification, are referred to as **"services"**.
2626

2727
# Library
2828

@@ -51,7 +51,7 @@ which the client should connect.
5151
This actor's role is solely that of launching and managing the stop of
5252
"WebSocket Server" actors listening on at a specific port and interface
5353
address ("Launch Server Msg" and "Stop Server Msg" messages). The actor
54-
will ensure that the launched "WebSocket Server" doesn’t conflict on
54+
will ensure that the launched "WebSocket Server" actor doesn’t conflict on
5555
interface and port resources. If the server is already running at that
5656
port or on the specified interface the method sends just the server
5757
enqueuer to the client. If the server is not running it will be
@@ -80,7 +80,7 @@ protocol will take care of communicating the failure to the client.
8080

8181
## WebSocket Service.lvclass
8282

83-
It forwards packets received from the connected WebSocket Clients to its
83+
It forwards packets received from the connected "WebSocket Client" actors to its
8484
subscriber actor as "WebSocket Connection Handler Msg" messages. It
8585
allows the subscriber to send data to a specified client ("Send to Peer
8686
Msg" message of the parent "WebSocket Connection" class) or to all
@@ -95,11 +95,11 @@ WebSocket service actor enqueuer.
9595

9696
## Abstract messages
9797

98-
Two abstract messages must be subclassed to allow the interaction of either a WebSocket Server, a WebSocket Service or a WebSocket Client with the corresponding subscriber actor.
98+
Two abstract messages must be subclassed to allow the interaction of either a "WebSocket Server", a "WebSocket Service" or a "WebSocket Client" actor with the corresponding subscriber actor.
9999

100100
### WebSocket Connection Handler Msg.lvclass
101101

102-
This abstract message is sent by either the WebSocket Client or by the
102+
This abstract message is sent by either the "WebSocket Client" or by the
103103
WebSocket Service to the subscriber Actor on four events:
104104

105105
- Connect
@@ -119,12 +119,35 @@ corresponding event.
119119

120120
### WebSocket Server-Service Enqueuer Msg.lvclass
121121

122-
This abstract message is used either by the WebSocket Server Manager or
123-
by the WebSocket Server to send the just launched/added Server/Service
122+
This abstract message is used either by the **WebSocket Server Manager** actor or
123+
by the **WebSocket Server** actor to send the just launched/added Server/Service
124124
Enqueuer to the subscriber actor requesting the operation. Each
125125
subscriber actor requesting the operation should subclass this message
126-
and then override the Do.vi in which the Server/Service Enqueuer is
127-
stored in the requesting actor.
126+
and then override the Do.vi wherein the Server/Service Enqueuer can be read from the suitable abstract message property and stored in the subscriber actor.
127+
128+
## Errors
129+
All custom error generated by this library are forwarded to the appropriate subscriber actor to be handled by the "Handle Error" method. If such method is not overridden by the subscriber actor, the actor will stop when the subscribed actor generates an errors. All the errors generated the connection level will result
130+
131+
The custom errors defined by this library are the following:
132+
133+
### 512000: The WebSocket connection dropped for unknown reasons.**
134+
135+
This error is generated when the connection is dropped for an unknown reason most likely related to problems with the TCP/IP connection. In such cases a "Drop" type "WebSocket Connection Handler Msg" concrete message will be fired, allowing the subscriber (either a to a "WebSocket Client" actor or a "WebSocket Server" actor) to react to this situation by overriding the Drop method within the message concrete implementation. Please note that if the Keepalive system is activated and a peer doesn't reply within the specified timeout, no error is generated. Rather, only the "Drop" type message is fired.
136+
137+
### 512001: The WebSocket Server could not establish a connection to the peer for unknown reasons.
138+
139+
This error is generated by the "WebSocket Server" actor when he is not able to establish a connection to the WebSocket client. In such cases the is presumed that the "WebSocket Server" actor is still able to establish new connections if requested.
140+
141+
### 512002: The WebSocket Server listener could not be created. Server is going to stop.
142+
This is generated upon a "WebSocket Server" actor launch in case a TCP/IP listener cannot be created. In such case the Actor will stop.
143+
144+
### 512003: The WebSocket Server listener became invalid for unknown reasons. The WebSocket Server is not accepting the definition of any new server.
145+
146+
This is generated within the lifetime of a "WebSocket Server" actor when the TCP/IP listener becomes invalid. In such case the Actor will not stop, but will not be accepting the addition of any new service from the subscriber.
147+
148+
### 512004: The WebSocket Server is not accepting the definition of any new service.
149+
In case one tries to add a service to a "WebSocket Server" actor that stopped to accept the addition of new services (see Error 512004) the subscriber demanding an addition will receive this error.
150+
128151

129152
# API
130153

@@ -144,7 +167,7 @@ Before launch the "Server Manager Actor" can be configured with the Keepalive se
144167

145168
![](media/Server%20Menager%20Configuration.png)
146169

147-
**Keepalive** The Keepalive settings will be active for all the WebSocket Servers launched by the "WebSocket Server Manager Actor"
170+
**Keepalive** The Keepalive settings will be active for all the WebSocket Servers launched by the "WebSocket Server Manager" actor
148171

149172
**Certificate Chain** specifies an array of Distinguished Encoding Rules (DER) certificates. The certificates must be supplied depth-first: the server's certificate, followed by the Certificate Authority (CA) that signs the certificate of the server, on up to the root CA. For more details see LabVIEW TLS examples.
150173

@@ -198,13 +221,13 @@ Enqueuer Msg.lvclass*”.
198221
alt="A computer screen shot of a message Description automatically generated" />
199222

200223
**Subscriber Enqueuer** specifies the enqueuer of the actor that has
201-
subscribed to the previously launched WebSocket Server actor.
224+
subscribed to the previously launched "WebSocket Server" actor.
202225

203-
**Message Enqueuer in** specifies the enqueuer of the WebSocket Server
204-
Manager actor to be stopped.
226+
**Message Enqueuer in** specifies the enqueuer of the "WebSocket Server
227+
Manager" actor to be stopped.
205228

206229
**Listener Settings** specifies the listener settings for the previously
207-
launched WebSocket Server actor.
230+
launched "WebSocket Server" actor.
208231

209232
**Handshake timeout** specifies the timeout of the handshake when the
210233
client establishes a WebSocket connection to the server.
@@ -215,7 +238,7 @@ Enqueuer Msg.lvclass*”.
215238

216239
## WebSocket Server
217240

218-
In case the WebSocket Server Actor is manually launched the following
241+
In case the "WebSocket Server" actor is manually launched the following
219242
properties are available to configure it (the port must be entered)
220243
before its launch
221244

@@ -248,12 +271,12 @@ alt="A computer screen shot of a message Description automatically generated" />
248271
created) child of the abstract message “*WebSocket Server-Service
249272
Enqueuer Msg.lvclass”.*
250273

251-
**Message Enqueuer in** specifies the enqueuer of the WebSocket Server
274+
**Message Enqueuer in** specifies the enqueuer of the "WebSocket Server"
252275
actor.
253276

254277
**Service Name** specifies the name of the service.
255278

256-
**Subscriber Enqueuer** specifies the enqueuer of the actor that subscribes to the WebSocket Server Actor.
279+
**Subscriber Enqueuer** specifies the enqueuer of the actor that subscribes to the "WebSocket Server" actor.
257280

258281
**WebSocket Data Handler** specifies the concrete message (to be
259282
created) child of the abstract message “*WebSocket Connection Handler
@@ -285,7 +308,7 @@ we want to send the data
285308

286309
## WebSocket Client
287310

288-
The following properties of the WebSocket Client actor must be set
311+
The following properties of the "WebSocket Client" actor must be set
289312
before launching it:
290313

291314
![](media/image9.png)
@@ -307,7 +330,7 @@ created) child of the abstract message “*WebSocket Connection Handler
307330
Msg.lvclass”.*
308331

309332
**Subscriber Enqueuer** specifies the enqueuer of the actor (must be
310-
created) that subscribes to the WebSocket Client Actor.
333+
created) that subscribes to the "WebSocket Client" actor.
311334

312335
**Keepalive** specifies the Keepalive settings for the Client (see
313336
definition above).

WebSocket-Actor.vipb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<VI_Package_Builder_Settings Version="2020.1" Created_Date="2023-10-14 14:13:00" Modified_Date="2024-11-11 13:43:39" Creator="AndreaVaccaro(LSInst" Comments="" ID="96f1c4342f2a2ad4dc1b779bdc0d6cd8">
1+
<VI_Package_Builder_Settings Version="2020.1" Created_Date="2023-10-14 14:13:00" Modified_Date="2024-11-12 01:01:01" Creator="AndreaVaccaro(LSInst" Comments="" ID="0b783b623b854da272694ebf5a245556">
22
<Library_General_Settings>
33
<Package_File_Name>LS_Instruments_AG_lib_WebSocket_Actor</Package_File_Name>
4-
<Library_Version>1.1.0.9</Library_Version>
4+
<Library_Version>1.1.0.10</Library_Version>
55
<Auto_Increment_Version>false</Auto_Increment_Version>
66
<Library_Source_Folder>.</Library_Source_Folder>
77
<Library_Output_Folder>vipm packages</Library_Output_Folder>
@@ -409,7 +409,7 @@ Look at the LabVIEW example folder for a comprehensive set of examples.
409409
<Path>WebSocket Actor\WebSocket Server\typedefs\Listener Settings.ctl</Path>
410410
<VI_Title/>
411411
</Items_Data>
412-
<GUID>DC2C81D4ED07D5FED4778C7E989521D9</GUID>
412+
<GUID>016F89B944D3405E43D3DE75F66F8DF6</GUID>
413413
</Functions_Palette_Data>
414414
<Functions_Palette_Data>
415415
<Parent_Palette_Index>0</Parent_Palette_Index>
@@ -458,7 +458,7 @@ Look at the LabVIEW example folder for a comprehensive set of examples.
458458
<Path>WebSocket Actor\WebSocket Actor Palette\WebSocket Server-Service Enqueuer Msg.vi</Path>
459459
<VI_Title/>
460460
</Items_Data>
461-
<GUID>AC6F7C38337730B4B47266109F7BE110</GUID>
461+
<GUID>BE70D2E87DEB3E95654A0A55EA102A8A</GUID>
462462
</Functions_Palette_Data>
463463
<Functions_Palette_Data>
464464
<Parent_Palette_Index>0</Parent_Palette_Index>
@@ -535,7 +535,7 @@ Look at the LabVIEW example folder for a comprehensive set of examples.
535535
<Path>WebSocket Actor\WebSocket Actor Palette\WebSocket Service.vi</Path>
536536
<VI_Title/>
537537
</Items_Data>
538-
<GUID>16F1928E68EE6DBAD1033183FA2B55F1</GUID>
538+
<GUID>96E02BA8DD9C7A270EAA5081715D00C2</GUID>
539539
</Functions_Palette_Data>
540540
</Library_Palette_Definition>
541541
</VI_Package_Builder_Settings>

WebSocket-Actors-errors.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ Custom error codes defined by the "WebSocket-Actors" library.
1010
</nifamily>
1111
</nicomment>
1212
<nierror code="512000">
13-
The WebSocket connection dropped for unknown reasons
13+
The WebSocket connection dropped for unknown reasons.
1414
</nierror>
1515
<nierror code="512001">
16-
The WebSocket Server could not estabilish a connection to the peer for unknown reasons
16+
The WebSocket Server could not establish a connection to the peer for unknown reasons.
1717
</nierror>
1818
<nierror code="512002">
19-
The WebSocket Server listener could not be created. Server is going to stop
19+
The WebSocket Server listener could not be created. Server is going to stop.
2020
</nierror>
2121
<nierror code="512003">
22-
The WebSocket Server listener became invalid for unknown reasons. The WebSocket Server is not accepting the definition of any new server
22+
The WebSocket Server listener became invalid for unknown reasons. The WebSocket Server is not accepting the definition of any new server.
2323
</nierror>
2424
<nierror code="512004">
2525
The WebSocket Server is not accepting the definition of any new service.

0 commit comments

Comments
 (0)