Lets imagine the same scenario as described in part III.
Now, we will talk about websockets.
Websockets is a new technology introduced with HTML5 browsers. It allows you to connect to the server from a Javascript application running on your client browser and keep the connection open (no need for page reloads, sessions, cookies, etc.). Using websockets we can write our applications with the right/intuitive logic.
You can even omit the HTML tags and use Javascript only (you can create form controls directly from Javascript) to make it easier and intuitive.
So, the definitive winner combination is:
1. A Harbour Websockets server (We have it!).
2. A Javascript web client capable to connect to the Harbour websockets server, ask it for something and process the answer (We have it too!).
The server was posted by Daniel Garcia Gil in the Harbour developers list.
I've made to it some little modifications. So, instead of send the messages received to the Harbour preprocessor, I analyze the message and created specific code to each one.
The server (source and exe) and the HTML client are attached to this message.
I've modified wssocket.prg (between lines 230-246) as follows:
Code: Select all
* HERE IS THE IMPORTANT STUFF !!!! *********************************************
IF cMsg == 'PROC_1'
cAnswer := 'PROC_1 Return Value'
ELSEIF cMsg == 'PROC_2'
cAnswer := 'PROC_2 Return Value'
ELSE
cAnswer := 'ERROR: Invalid Procedure Name'
ENDIF
* END OF IMPORTANT STUFF !!!! **************************************************
The client HTML file, has a command line and a window to show the server's answers.
The only thing you must to do, is to write the adecuate message and press <ENTER>.
You simply must to unzip the attached file, execute 'wssocket.exe' and then open wstest.html with you web browser.
It looks as follows:
This is a basic proof of concept. I'll describe the complete path in another (and final) post.
Enjoy!.