There may be times when you might need users to connect to many instances of the same merged server application. When this happens, the merged client application downloads as many local resources as the server connections. But if your server’s Resources folder is huge, this can be quite a drain on time, volume, and network! Fortunately, 4D v18 R5 has a solution for this scenario!
Connecting your remote application to several servers, as described in the above picture, results in obtaining this local Resources folder in the system:
Rather than using the server’s time-consuming Resources folder, you have the ability to share the same local Resources folder between all these strictly identical servers.
Legacy REMOTE applications
A new buildApp key is at your disposal to share the local Resources folder:
When connecting to a server, the server information is replaced by the string you set when building the application. We’ve kept the final key to allow you to use as many remote applications as you want on the same computer. The local Resources folder now looks like this:
You can always connect to the server using the built-in login dialog. In this case, the cache folder that is used is no longer the one composed of your custom information (application name, IP, and port), but the one set when the application was built.
REMOTE running CUSTOM connection DIALOG
In this blog post, we learned how to use a connection database instead of the legacy 4D connection dialog in your merged remote applications. The behavior is based on using a custom 4DLink file with the OPEN DATABASE command.
You can define the local resources root name using the new key cache_folder_name in the 4DLink file.
Using the same example as in the previously mentioned blog post, here’s the code snippet from a server selection dialog where Form.selectedServer contains the 4D Server information:
$xml:="<?xml version=\"1.0\" encoding=\"UTF-8\"?><database_shortcut is_remote=\"true\" server_database_name=\"FA_RemoteConnexionServ\" server_path=\""+Form.selectedServer.IP+":"+Form.selectedServer.portID+"\" cache_folder_name=\""+Form.selectedServer.customCacheFolder+"\"/>"
$link:=Folder(fk user preferences folder).file("server.4dlink")
Keep in mind
If you modify your server application package, the automatic local resources update will be performed for each different package. But as long as all your server application packages are strictly identical, the local resources are downloaded only when needed: at the first server connection!