Show/Hide Toolbars

Managing an FVTerm Child iFrame in Javascript

Navigation: Advanced Sharing with a Web Service Application

Connecting an FVTerm Session to an Existing Session

Scroll Prev Top Next More

A common scenario is to connect a user at a browser to a session that has already been connected to and interacted in some manner using a Inventu Viewer+ web service.  The client of a Inventu Viewer+ Web Service is provided a sessionKey (type=string) as a standard portion of the returned information from a call.

 

Connecting to an Existing Session with the FVTermSession Class (Direct)

 

The ConnectFVTerm function in the FVTermParent.js file provides the recommended way to not only start an existing session, but to maintain integration with that session.  Here is an example function that connects and sets-up an event listener on each screen received in the browser:

 

 var fvt = null;

 function StartFVTerm(sessionKey)

 {

         ConnectFVTerm('FVTerm', '/FVTerm/SCTerm.html', {"sessionKey":sessionKey},

         function ()

         {

                 fvt = fvTermSession;

                 fvt.onnewscreen = onNewScreen;

         });

 }

 

Connecting to an Existing Session with the FVAPISession Class (Messaging)

 

The FVMsgApi.ConnectMsgFVTerm function in the FVTermMsgApi.js file provides the recommended way to not only start an existing session, but to maintain integration with that session.  Here is an example function that connects and sets-up an event listener on each screen received in the browser:

 

 var fvApi = null;

 function StartFVTerm(sessionKey)

 {

         FVMsgApi.ConnectMsgFVTerm('FVTerm', '/FVTerm/SCTerm.html', {"sessionKey":sessionKey},

         function (fvApiNew, sessionKey)

         {

                 fvApi = fvApiNew;

                 fvApi.onnewscreen = onNewScreen;

         });

 }

 

Connecting Directly to an Existing Session (no Api Interaction)

 

With the sessionKey string value available to a parent frame, the SRC of the FVTerm-containing iFrame can be statically or dynamically set as follows (based on the example from the Initiating a New Terminal Session section:

 

http[s]://[servername][port]/FVTerm/SCTerm.html?Application=&sessionKey=[sessionKey]

 

Example:

 

http://myserver/FVTerm/SCTerm.html?Application=&sessionKey=8_abEv233ad90

 

When the iFrame starts with the above URL, the FVTerm code will connect via the standard FVTerm web services to the session that is associated with the session key.

 

Session Management Considerations

 

The Inventu Viewer+ sessions have controls to avoid uncoordinated connections by multiple HTTP requests/threads.  As a result, if a session has been in the control of a web service, the session must be released properly.  Within the standard Inventu Viewer+ Web service framework, this is achieved using the TaskSession.SessionReserve() method.  The TaskSession object is typically referred within the Inventu Viewer+ code as "ts" so in an ASMX module that is about to give control to an emulator session that call would be ts.SessionReserve();.

 

If control is then to be returned from FVTerm, additional management is required.  See the next section, Simple Coordination with the FVTerm Connections for how this management is achieved.