Deep linking with `fin` and `fins` protocols

The RVM permits deep linking to an OpenFin application from anywhere that can invoke a link, such as a browser, email client, or another OpenFin application.
This works similarly to deep links on mobile platforms that invoke a mobile app rather than a website.
The RVM uses a custom protocol handler for URLs that start with fin: or fins:, to invoke the application, if not already running, and to pass context an OpenFin application via the URL parameter.

Example deep link:

fins://mydomain.com/path-to-manifest/app.json?$$parameter1=value1&$$parameter2=value2

Note that the RVM passes to the application only URL parameters that are prefixed with two dollar signs ($$). For URL parameters with one or zero dollar signs, the RVM treats them as part of the base URL.

An application needs to handle URL parameters in both of two cases:

  • When the app is first launched, the initial parameters can be accessed via Application.getInfo().

  • When the app is invoked when it is already running, the args object on the run-requested application event contains them.

Retrieving arguments from the initial launch:

// Application.getInfo can be used to retrieve initial launch args
const thisApp = fin.Application.getCurrentSync();
const info = await thisApp.getInfo();
const { userAppConfigArgs } = info.initialOptions;
console.log(userAppConfigArgs.parameter1);

Getting arguments when the app is already running:

// If the app is already running, parameters are passed through the 
//“run-requested” event 
thisApp.addListener("run-requested", function (event) { 
   if(event.userAppConfigArgs){ 
      //args parameter contains deep link context
      console.log(event.userAppConfigArgs.parameter1); 
   } 
})