PDA

View Full Version : Communicating between Delphi App and Browser App



czar
20-02-2013, 12:40 AM
I have a unique problem (I believe).

I am using embedded chromium (DCEF3) to render some HTML 5 games on a desktop computer. I need to have information going to an from the browser.

I can use web storage, localstorage to store data from session to session, however, I need that data to also be available to the Delphi part so that I can use that information elsewhere.

1. Is there a way that Delphi can read out values of localstorage?

2. Is there another way I can communicate between the browser and the delphi app?

I thought about using a database. However, the workstations don't have internet access, and even then setting values in an online database to then read them back to the delphi seemed not so elegant faster or reliable.

Any ideas would be helpful. I have put a post on the embedded chromium forum but the forum seems very dead, no activity.

Dan
20-02-2013, 04:21 AM
one solution I can see right away is to run a server with the database on the workstation rather than online. then you can simply communicate with your database using the localhost address from both the browser and delphi. it should be reasonably fast and reliable. but you will have to remember to start the server every time you turn on the workstation.

the other way I can think of is to use the global storage, it should be available to any application.

czar
20-02-2013, 06:22 AM
I had considered a local database but I thought it might be overkill. I already a mini-web server on the workstation and the embedded chromium simply display the "web" on that TinyWebServer. It works nicely, the server is started by the browser app and closed down when it is no longer required. I would have to see if I can run a database on either the tiny webserver or the browser app. I will look into it.

cheers

czar
23-02-2013, 02:13 AM
The solution was pretty obvious in the end. I am using ajax to send info to the TinyWebServer that then makes the info known to the browser app. Problem sorted.

laggyluk
23-02-2013, 08:21 PM
I guess you could also use cookies for that. folder for storing cache can be set in dcef so it persists between sessions