Learn How To Deploy Delphi 10.3 Rio FireMonkey Apps In The Cloud Via HTML5

Delphi 10.3 Rio FireMonkey apps are cross platform with a single codebase and single UI that target the Android, IOS, Macos, Windows, and Linux platforms (FMXLinux was recently added to Delphi 10.3 Rio Enterprise and Architect). You can also deploy Delphi FireMonkey apps to the web using websockets and HTML5. The method for doing this is basically the FireMonkey app runs on a Windows or Linux server and it’s canvas draws are sent to the web browser via a websocket. Each user connection runs one copy of the app on the server (so one user one app). The server is running the app so it needs enough hardware for however many concurrent apps you want to run.

For FireMonkey Windows apps this can be achieved through Thinfinity VirtualUI. Thinfinity is a commercial product which a cost per concurrent user. The user connects to the Thinfinity server, Thinfinity launches the FireMonkey app, handles the user input, and sends the drawing to the browser client. Thinfinity has been around for quite a few years and I would consider it a pretty mature product. It supports enterprise features like load balancing and ActiveDirectory login. You can also use it with Windows apps written in other languages (like C++ and C#).

For FireMonkey Linux apps this can be achieved through FMXLinux and Gtk Broadwayd. FMXLinux is also a commercial product but has recently been made available to Delphi 10.3 Rio Enterprise and Architect developers for free (just open GetIt and install it). FMXLinux allows FireMonkey apps to run on Linux desktops using the Gtk UI library. Gtk comes with an application called Broadwayd which will stream the Gtk app out to HTML5 via websockets. Broadwayd runs on a single port (8080) per app and you can click compile in Delphi 10.3 Rio and see your FireMonkey app in the browser served up from you Linux machine if you start the broadwayd server prior to deployment. If you want to run a pool of FireMonkey apps on Linux like Thinfinity does on Windows you can set up a Linux bash script to do so.

The purpose of the bash script is to run X number of FireMonkey apps through broadwayd (remember 1 app per port) and then use a load balancer make all of the apps accessible via a single port. In order to do this second part there is a Linux package called balance which can do this for you. One limitation of it is that it will only do 16-32 apps in it’s app pool unless you compile the source yourself. You can install balance with “sudo apt install balance” on Ubuntu or “yum install balance” on CentOS. Broadwayd and balance are open source and free applications but the solution is also not as polished as Thinfinity UI. You could also build something in Delphi using TidMappedPortTCP instead of using balance. For commercial deployments I’d recommend going with Thinfinity though.

Here is the sample bash script I put together which handles hosting multiple apps on a single port for you. Save the script as gtkcloud.sh and “chmod +x gtkcloud.sh”. It takes two parameters. The first parameter is the path to the app you want to run and the second parameter is the port you want to run the load balanced app on.

Example usage is as follows and would host 16 instances of /root/FireMonkeyPaintDemo on port 81.

./gtkcloud.sh /root/FireMonkeyPaintDemo 81

And that is all there is to it. You can run your Delphi FireMonkey apps on Android, IOS, Macos, Windows, Linux, AND the web using a single codebase and single UI.

Download the gtkcloud broadwayd + balance bash script for hosting Delphi FireMonkey FMXLinux apps.

Don’t have Delphi 10.3 Rio Enterprise or Architect? You can still use FMXLinux with you Delphi Pro FireMonkey apps.

Head over and check out the full website for FMXLinux and learn about deploying Delphi desktop apps to Linux.

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

2 Responses to Learn How To Deploy Delphi 10.3 Rio FireMonkey Apps In The Cloud Via HTML5

  1. Pingback: Mega Fixes And Updates For Delphi 10.3.2 Firemonkey On Android, IOS, MacOS, Windows, And Linux | Delphi XE5 XE6 XE7 XE8 10 Seattle Berlin Tokyo Rio Firemonkey, Delphi Android, Delphi IOS

  2. Pingback: 50 Cross Platform Samples For Android, IOS, OSX, Windows, Linux, And HTML5 In Delphi | Delphi XE5 XE6 XE7 XE8 10 Seattle Berlin Tokyo Rio Firemonkey, Delphi Android, Delphi IOS

Leave a Reply

Show Buttons
Hide Buttons
Read previous post:
50+ RAD Server REST Clients In Many Languages For Most Platforms

RAD Server has built in support for the OpenAPI (Swagger) REST endpoint documentation format. It provides both YAML and JSON...

Close