My earlier posting introduced EWD’s new realtime web framework and described the EWD application that demonstrates all its capabilities.
In this posting, I’ll explain how to get the framework and the example EWD application working with Caché, running on Windows 7. Just follow the steps below:
1) If you’ve not already done so, follow the instructions in my earlier posting on how to install EWD, Node.js and the ewdGateway2 module. These steps will install the latest version of EWD so when you’ve completed this step, proceed now to Step 3
2) If, however, you’d already installed EWD, Node.js and the ewdGateway2 module, you’ll need to upgrade EWD as follows:
- Download EWD from http://www.mgateway.com. You’ll need to click on the tabs markedEWD/Download EWD/EWD for Caché, then fill out the form.
- Expand the downloaded zewdxxx.zip file and find the file inside it named zewd.xml. Copy this to the c:/InterSystems/Cache/Mgr directory (or wherever your Caché Mgr directory resides)
- Start a Cache Terminal session and type:
- zn “%sys”
- d import^%zewdAPI()
- You’ve now updated EWD to the latest build (currently 960). You can test it’s OK by running the function:
- w $$version^%zewdAPI()
- You should be told the build number of the version of EWD you just installed (eg 960).
3) Now install the very latest ewdGateway2 module using npm (even if you’d followed the instructions for Step 1):
- Start a Command Prompt window and enter the following commands:
- cd \node
- npm install ewdgateway2
4) Now move or copy the file c:\node\node_modules\ewdgateway2\examples\ewdStart-cache.js to c:\node
5) Next, we need to get a copy of the realtime web EWD application named ewdGateway2:
- In a browser, navigate to the ewdGateway2 repository on Github:
- Click the Zip button and download the repository as a zip file
- Open the zip file and navigate to the path ewdGateway2-master/ewdapps
- Copy the subdirectory named ewdGateway2 from this zip file path into your c:\ewdapps directory: ie you should now have a directory named c:\ewdapps\ewdGateway2 containing the source EWD files for the realtime web application.
6) Compile this new EWD application named ewdGateway2:
- Open a Cache Terminal session
- in the “USER” namespace, type:
- d compileAll^%zewdAPI(“ewdGateway2″,,”ewd”) (notice those two commas!)
7) Now move a couple more files:
- move or copy c:\ewdapps\ewdGateway2\js\ewdGW2.js to c:\node\js
- move or copy c:\ewdapps\ewdGateway2\node\ewdGW2Mgr.js to c:\node
8) Start a Windows Command Prompt window and start the Node.js ewdGateway2 process:
- cd \node
- node ewdStart-cache
9) The ewdGateway2 module should now be successfully up and running and listening for incoming HTTP requests on port 8080, so start up a browser and start the EWD application named ewdGateway2:
10) The login form should appear against a greyed-out ExtJS layout. The password iskeepThisSecret! (This is defined in the file c:\node\ewdStart-cache.js – find the management.password setting. If you want to change it, edit ewdStart-cache.js and then stop and restart the ewdGateway2 Node.js process.
The ewdGateway2 monitoring/management application should now be running, showing you the latest status of your Node.js-based ewdGateway2 module and its associated child Node.js processes, in addition to the EWD run-time/session environment within the Caché database. I’ll describe its operation in more detail in a later posting, but for now feel free to explore its many options. Everything you’ll see changing in the display is happening in real-time, driven by WebSockets messages: there’s no traditional HTTP processing happening at all!
Welcome to the cool and exciting future: realtime web applications!