Namespace: receiver
receiver
citrix.receiver
Members
(static) Utils
Utils to read/write from/to a Uint8Array. Supported reading/writing of 1-4 bytes of data. Refer to individual api examples to construct/parse the packet as per structure. You can refer to the sample VC examples (ping, mix and over), provided for more details on usage.
Properties
Name | Type | Description |
---|---|---|
utils | Object | Object of Utils |
(readonly) apiVersion
Properties
Name | Type | Description |
---|---|---|
apiVersion |
String | Virtual Channel SDK for Chrome version. |
Methods
(static) onMessage(event)
Third-party must listen for window.onmessage. When third-party receives Citrix-related messages, it must check the origin of the message. After verifying the origin, the message must be passed using citrix.receiver.onMessage(event).
Parameters
Name | Type | Description |
---|---|---|
event |
Object | Received message. Citrix messages can be filter out using event[ data][ source]== CITRIX&& event[ data’][destination ]==VCSDK . Note: These comparisons are not sufficient to trust message origin. |
Example
window.onmessage = (event)=>{
//verify origin of event
if(event['origin] == 'trusted url'
&& event['data]['source'] == 'CITRIX' //TO filter out citrix related messages
&& event['data']['destination'] == 'VCSDK')
{
citrix.receiver.onMessage(event);
}
}
<!--NeedCopy-->
(static) registerVC(vcInfo)→ {CustomVC}
Registers the handlers for the virtual channel and returns the object that needs to be stored.
Note:
All the sessions would use the same callbacks for each functionality.Session ID must be used to differentiate between different sessions.
Parameters
Name | Type | Description |
---|---|---|
vcInfo |
Object | Object containing the details of the virtual channel name, version, description, and the callbacks for various functionalities |
Properties of vcInfo
Name | Type | Attributes | Description |
---|---|---|---|
streamName |
String | Virtual Channel name | Must be an ASCII string with a maximum of 7 letters. |
description |
String | optional | Description of the Virtual channel. |
minVersion |
String | optional | Lowest supported version of this virtual channel, used to allow version negotiation between the client-side and the server-side components. |
maxVersion |
String | optional | Highest supported version of this virtual channel, used to allow version negotiation between the client-side and the server-side components. |
driverOpen |
driverOpen | Callback that gets called when the virtual channel is about to be opened in the session. Called for each session launch. | |
driverInfo |
driverInfo | Callback that gets called to send any information about the virtual channel. Called for each session launch. | |
icaDataArrival |
icaDataArrival | Callback set for receiving the ICA packet from the server side component of the virtual channel. | |
driverClose |
driverClose | Callback set for receiving the virtual channel close in the session. |
Throws
Error during registration of virtual channel.
Type
Returns
Object of CustomVC.
Type
Example
//Registering CTXPING virtual channel
var ctxping = citrix.receiver.registerVC({"streamName":"CTXPING",
"driverOpen":pingDriverOpen,
"driverInfo":pingDriverInfo,
"icaDataArrival":pingIcaDataArrival,
"driverClose":pingDriverClose});
<!--NeedCopy-->
(static) registerEventListener(eventName, callback)
Registers the event listeners for the supported eventNames and the callback
Parameters
Name | Type | Description |
---|---|---|
eventName |
String | Event name Events of the event to register the listener |
callback |
callback | To receive data of the registered event type |
Example
//Registering eventListener for receiving VDA session size
citrix.receiver.registerEventListener(eventName setVdaSessionSize, (vdaSessionSize) => {
console.log("Width:", vdaSessionSize.width, "height:", vdaSessionSize.height);
});
<!--NeedCopy-->
(static) getMonitorDetails(vcInfo)→ {Promise}
Function to get the promise which resolves with display details.
Returns
Promise that is resolved with a displayDetails object.
Type
Promise
Example
// Example : Query display details
let displayDetails = citrix.receiver.getMonitorDetails()
<!--NeedCopy-->
(static) getCapabilities(vcInfo)→ {Promise}
Function to get the promise which resolves with capabilities which contain the list of functionalities available for use.
Returns
Promise that is resolved with a capabilities object.
Note:
To ensure forwards and backwards compatibility of third-party plug-in with Citrix Workspace app for ChromeOS, it is recommended to use the returned capability and perform API availability check along with handling both API available and not available scenarios.
Type
Promise
Example
let capabilities = await citrix.receiver.getCapabilities();
//API availability check
if(capabilities.monitorLayout){
//...
//Handle API available flow
monitorDetails = citrix.receiver.getMonitorDetails();
//...
}else{
//... monitorDetailsUnavailableFlow();
}
<!--NeedCopy-->