SDK and API

HDX SDK

Citrix Workspace app for Chrome introduces an API (Experimental API) that allow third-party Chrome apps to lock, unlock and disconnect from a Citrix Virtual Apps and Desktops session. Using this API, Citrix Workspace app for Chrome can be launched in both embedded mode and kiosk mode. Sessions launched in embedded mode function in ways similar to sessions launched kiosk mode.

For the SDK documentation, see HDX SDK for Citrix Workspace app for Chrome.

For HDX SDK examples, refer to the Citrix download page.

Citrix Virtual Channel SDK

The Citrix Virtual Channel Software Development Kit (SDK) provides support for writing server-side applications and client-side drivers for additional virtual channels using the ICA protocol. The server-side virtual channel applications are on Citrix Virtual Apps or Citrix Virtual Apps and Desktops servers. This version of the SDK provides support for writing new virtual channels for Citrix Workspace app for Chrome. If you want to write virtual drivers for other client platforms, contact Citrix.

The Virtual Channel SDK provides:

  • An easy interface that can be used with the virtual channels in the Citrix Server API SDK (WFAPI SDK) to create new virtual channels.

  • Working source code for several virtual channel sample programs that demonstrate programming techniques.

  • The Virtual Channel SDK requires the WFAPI SDK to write the server side of the virtual channel.

For the VC SDK documentation, see Citrix Virtual Channel SDK for Citrix Workspace app for Chrome.

For VC SDK examples, refer to the Citrix download page.

Procedure to consume the API in the third-party Chrome app

  1. Install the latest version of Citrix Workspace app for Chrome. See Citrix downloads page for details.
  2. Whitelist the third-party Chrome app by adding the policy file for Citrix Workspace app for Chrome using Chrome management settings. For more details, see Manage Chrome Apps by organizational unit on Google support. The Sample policy.txt file to whitelist the third-party Chrome app is as below:

    {
          "settings": {
                 "Value": {
                 "settings_version": "1.0",
                 "store_settings": {
                 "externalApps": [“<3rdParty_App1_ExtnID>”,“<3rdParty_App2_ExtnID>”]
                                   }
                           }
                    }
    }
    

    Note:

    <3rdParty_App1_ExtnID> is used as an example for the name of externalApps and can send messages to Citrix Workspace app for Chrome. Get your appid from the chrome://extensions site.

  3. Launch the application or desktop session in Citrix Workspace for Chrome by following the steps below:
  • Get the workspaceappID

    var workspaceappID = “ haiffjcadagjlijoggckpgfnoeiflnem “;

    Note:

    In this example, workspaceappID indicates the store version of Citrix Workspace app for Chrome. If you are using a repackaged version of Citrix Workspace app for Chrome, use the appropriate workspaceappID.

  • Convert ICA data from INI to JSON format.

    Note:

    Typically, the ICA file is retrieved from StoreFront as an INI file. Use the following helper function to convert a ICA INI file into JSON.

//Helper function to convert ica in INI format to JSON function convertICA_INI_TO_JSON(data){ var keyVals = {}; if (data) { var dataArr; if(data.indexOf(‘\r’)==-1){ dataArr = data.split(‘\n’); }else{ dataArr = data.split(‘\r\n’); } for (var i = 0; i < dataArr.length; i++) { var nameValue = dataArr[i].split(‘=’, 2); if (nameValue.length === 2) { keyVals[nameValue[0]] = nameValue[1]; } // This is required as LaunchReference will contain ‘=’ as well. The above split(‘=’,2) will not provide // the complete LaunchReference. Ideally, something like the following should be used generically as well // because there can be other variables that use the ‘=’ character as part of the value. if (nameValue[0] === “LaunchReference”) { var index = dataArr[i].indexOf(‘=’); var value = dataArr[i].substr(index + 1); keyVals[nameValue[0]] = value; } } console.log(keyVals);//to remove return keyVals; } return null; }

  • Send an ICA message from the third-party Chrome app to Citrix Workspace app for Chrome.

     var icaFileJson = {...}; // ICA file passed as JSON key value pairs.
     var message = {
     "method" : "launchSession",
     "icaData" : icaJSON
     };
     chrome.runtime.sendMessage(workspaceappID, message,
     function(launchStatus) {
     if (launchStatus.success) {
     // handle success.
     console.log("Session launch was attempted successfully");
     } else {
     // handle errors.
     console.log("error during session launch: ", launchStatus.message);
     }
     });
    
    

For more details on sendmesage API commands, see the following links:

https://developer.chrome.com/extensions/runtime#event-onMessageExternal

https://developer.chrome.com/extensions/runtime#method-sendMessage