Home Applications WebSocketClient CSP based

WebSocketClient CSP based

This application is not supported by InterSystems Corporation. Please be notified that you use it at your own risk.
3
1 reviews
0
Awards
212
Views
4
IPM installs
6
2
Details
Releases
Reviews  (1)
Issues
Articles  (1)
Extended CSP page consuming WebService as Client

What's new in this version

Automatic version update

The Caché / Ensemble standard distribution contains in namespace SAMPLES
a nice example of a CSP page consuming WebService as Client.
I have modified it not only to display the replies but to feed it back into a Global.
I used the classic Hyperevent to achieve this.
The replies end up as a log in global^WSREPLY.
When there is no input anymore the page closes and goes away.

There are 2 versions with visible and hidden display during operation.
dc.WSCSP.reverseVerbose.cls and dc.WSCSP.reverseHidden.cls

The message to send is simply passed as hash after the CSP_URL. (Mind URL encoding!)

You can launch the page using a command pipe or $zf(-1,…) or similar for newer versions
directly out of your application or from command line.

 /// find your browser location
 set browser="""C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"" "
 /// don't forget the # at the end
 set page="http://localhost:57772/csp/irisapp/dc.WSCSP.reverseVerbose.cls#"
 /// whatever you send to the server
 set msg="hello ALL"
 /// a CPIPE device
 set dev="|CPIPE|22"

// either
do $zf(-1,browser_page_msg)

// or
open dev:browser_page_msg:0 write $t close dev

and what you get on server looks like this:


^WSREPLY(34)=$lb("2019-02-08 18:03:11","Welcome to Cache WebSocket. NameSpace: SAMPLES")
^WSREPLY(35)=$lb("2019-02-08 18:03:11","'hello ALL' (length=9) recieved on 08 Feb 2019 at 06:03:11PM NameSpace=SAMPLES")
^WSREPLY(36)=$lb("2019-02-08 18:03:21","Timeout after 10 seconds occurred on 08 Feb 2019 at 06:03:21PM")
^WSREPLY(37)=$lb("2019-02-08 18:03:31","Timeout after 10 seconds occurred on 08 Feb 2019 at 06:03:31PM")
^WSREPLY(38)=$lb("2019-02-08 18:03:41","Timeout after 10 seconds occurred on 08 Feb 2019 at 06:03:41PM")
^WSREPLY(39)=$lb("2019-02-08 18:03:41","exit")

This is just a starting point to be adapted to you individual needs.

With Docker it might be hard to start a browser. ZPM is preferred.

Article in DC

Made with
Install
zpm install wscsp-client-dc download archive
Version
1.0.516 Sep, 2023
ObjectScript quality test
Category
Technology Example
Works with
CachéEnsembleInterSystems IRIS
First published
24 Jul, 2020
Last checked by moderator
01 Nov, 2023Works