This type is a user defined callback that is set in createDataSession function.
When openDataSession is called, this callback will be called asynchronously. The callback
may process the list of input proxies to choose the most appropriate one and call pSetProxyCallback to continue
the open data session procedure.
/** * Sample to illustrate the use of the the choice of a proxy for the open data procedure (DataSessionInterface). */ import { tChooseProxyCallback, ProxyChoiceInterface, tSetProxyCallback, InfiniteCacheInterface, DirectorySessionInterface, DataSessionInterface, DataSessionInterfaceSignal, tListenerCallback } from'generated/documentation/appinfiniteapi';
// lDirectorySession has been created previously, the user is now logged in and knows the 3djuump infinite available builds. letlDirectorySession : DirectorySessionInterface; // lInfiniteCache may has been created previously (not required) letlInfiniteCache : InfiniteCacheInterface | undefined; // the build id to connect to letlBuildId : string; // the callback that will be called when the DMU has finished loading letmyDMULoadedCallback : tListenerCallback;
// very simple callback, choose the first available proxy constlChooseProxyCallback : tChooseProxyCallback = (pProxies: Array<ProxyChoiceInterface>, pFinishLoadingCallback : tSetProxyCallback) : void=> { leti : number; constlLength : number = pProxies.length; // output all proxies for (i = 0; i < lLength; ++i) { console.log(pProxies[0].getLabel()); } // DO NOT forget to call pFinishLoadingCallback, if not, the DMU loading process will never finish // and with the url of the chosen proxy pFinishLoadingCallback(pProxies[0].getUrl()); }
// connect the data session to the build, the proxy choice is asynchronous, and will // trigger lChooseProxyCallback when the dev chooses a proxy constlDataSession : DataSessionInterface | undefined = lDirectorySession.createDataSession(lBuildId, lInfiniteCache, lChooseProxyCallback); if (!lDataSession) { console.log('something weird happened, the directory session cannot create a data session'); console.log('Perhaps the directory session is already closed, or closing, or the login procedure failed'); } else { // we sure want to be notified when the DMU has finished loading lDataSession.addEventListener(DataSessionInterfaceSignal.DMULoadingSuccess, myDMULoadedCallback);
// and GO => open the data session if (!lDataSession.openDataSession()) { console.log('something weird happened, this session has already been used, this is not a freshly created one'); }
// and wait for myDMULoadedCallback to be called }
Please refer to [DirectorySessionInterface](../interfaces/DirectorySessionInterface.html) for more information.
This type is a user defined callback that is set in createDataSession function.
When openDataSession is called, this callback will be called asynchronously. The callback may process the list of input proxies to choose the most appropriate one and call pSetProxyCallback to continue the open data session procedure.
Please refer to [DirectorySessionInterface](../interfaces/DirectorySessionInterface.html) for more information.
See