@@ -9,16 +9,16 @@ Client for WebSocket Servers and to collect the replies in IRIS.
9
9
10
10
I used node-v10.15.1-x64.msi and intersystems-iris-native package
11
11
12
- ### How it works
12
+ ## How it works
13
13
You provide a Global for input in namespace USER (default)
14
14
15
- set ^ZSockIn (0)=6
16
- set ^ZSockIn (1)="Hello"
17
- set ^ZSockIn (2)="World !"
18
- set ^ZSockIn (3)="Robert"
19
- set ^ZSockIn (4)="is waiting"
20
- set ^ZSockIn (5)="for replies"
21
- set ^ZSockIn (6)="exit"
15
+ set ^ZSocketIn (0)=6
16
+ set ^ZSocketIn (1)="Hello"
17
+ set ^ZSocketIn (2)="World !"
18
+ set ^ZSocketIn (3)="Robert"
19
+ set ^ZSocketIn (4)="is waiting"
20
+ set ^ZSocketIn (5)="for replies"
21
+ set ^ZSocketIn (6)="exit"
22
22
23
23
The server is controlled by ^ZSocketRun from IRIS
24
24
@@ -29,53 +29,66 @@ set ^ZSocketRun=1 ; => send to echo server
29
29
30
30
and from echo server you get back a Global as output
31
31
written by Node.js using the Native API for Node.js
32
-
33
- zwrite ^ZSockOut
32
+ ```
33
+ zwrite ^ZSocketOut
34
34
^ZSocketOut="wss://ws.postman-echo.com/"
35
- ^ZZSockOut(0)=6
36
- ^ZSockOut(1)="Hello"
37
- ^ZSockOut(2)="World !"
38
- ^ZSockOut(3)="Robert"
39
- ^ZSockOut(4)="is waiting"
40
- ^ZSockOut(5)="for replies"
41
- ^ZSockOut(6)="exit"
42
-
35
+ ^ZSocketOut(0)=6
36
+ ^ZSocketOut(1)="Hello"
37
+ ^ZSocketOut(2)="World !"
38
+ ^ZSocketOut(3)="Robert"
39
+ ^ZSocketOut(4)="is waiting"
40
+ ^ZSocketOut(5)="for replies"
41
+ ^ZSocketOut(6)="exit"
42
+ ```
43
+ Or run
44
+ ```
45
+ USER>do ^ZSocket
46
+ ```
43
47
### Local installation and operation
44
48
The WebSocket Service is started from OS command line.
45
49
You can follow the progress in console output
46
-
47
- * C:\Program Files\nodejs\cache>node WebSocketIRIS.js*
48
-
50
+ ```
51
+ C:\Program Files\nodejs\cache>node WebSocketIRIS.js <server-ip>:<superserver-port>
52
+ ```
49
53
![ image] ( https://github.com/rcemper/WebSocketIRIS.js/assets/31236645/7791b075-4474-4649-bb3b-de7db1f7fff0 )
50
54
51
55
[ Comment in DC] ( https://community.intersystems.com/post/client-websockets-based-nodejs#comment-128726 )
52
56
53
57
## Docker support
54
58
### Prerequisites
55
59
Make sure you have [ git] ( https://git-scm.com/book/en/v2/Getting-Started-Installing-Git ) and [ Docker desktop] ( https://www.docker.com/products/docker-desktop ) installed.
56
-
57
60
### Installation
58
61
Clone/git pull the repo into any local directory
59
- ````
62
+ ```
60
63
git clone https://github.com/rcemper/WebSocketIRIS.js.git
61
- ````
62
-
64
+ ```
63
65
Open the terminal in this directory, build and run the container:
64
-
65
- ````
66
+ ```
66
67
docker-compose up -d
67
- ````
68
+ ```
68
69
Next open a IRIS session in namespace USER and prepare the Globals for testing
69
70
a test program ** ZSocket.MAC** is in subdirectory ** src** of download directory
70
71
71
- ![ image] ( https://github.com/rcemper/WebSocketIRIS.js/assets/31236645/87032767-8b47-442b-8a19-84ed8b0e0fa2 )
72
-
73
72
Now activate your Node.js client
74
73
Have the external IP address and the SuperServerPort ready !
75
74
default: localhost:1972 is just a placeholder
76
-
77
- * docker-compose exec wsock nodejs WebSocketIRIS.js <ip-adr >:<port >*
78
-
79
- ![ image] ( https://github.com/rcemper/WebSocketIRIS.js/assets/31236645/97836bfb-dc65-4352-b47c-37753a8f53f4 )
80
-
81
-
75
+ ```
76
+ docker-compose exec wsock nodejs WebSocketIRIS.js <ip-adr>:<port>
77
+ ```
78
+ From IRIS terminal run
79
+ ```
80
+ USER>do ^ZSocket
81
+
82
+ *** Welcome to WebSocket Micoservice demo ***
83
+ Known Hosts (*=Exit) [1]:
84
+ 1 wss://ws.postman-echo.com/raw
85
+ 2 --- server 2 ----
86
+ 3 --- server 3 ----
87
+ select (1): 1 ==> wss://ws.postman-echo.com/raw
88
+ #
89
+ Enter text to get echoed from WebSocketClient Service
90
+ Terminate with * at first position
91
+ or get generated text by %
92
+ or append new text with @
93
+ ```
94
+
0 commit comments