Implementing Connection / Reconnection Logic (Disable Reconnection Warning)
This tutorial guides you through the process of implementing connection reconnection logic in your project. Follow the steps below to ensure a smoother experience for users during network instability by controlling display behavior and handling connection events efficiently.
Step 1: Adding disableDisplayWhileReconnecting
Option
- Locate the vnc.js file within your project directory.
- Insert the following configuration option:
disableDisplayWhileReconnecting: true/false
This option dictates whether to display the interface during the reconnection process. Set it to true
to activate this feature.
Step 2: Adding Connection Event Handlers
- In the
customSettings.vnc.js
file, search for the following code segment:
vnc.onConnectionLost = function (jData) {
// -- TO CUSTOMIZE
helper.console.log("onConnectionLost", arguments);
};
vnc.onConnectionRestored = function (jData) {
// -- TO CUSTOMIZE
helper.console.log("onConnectionRestored", arguments);
};
Tailor the logic within each event handler according to your project's needs. You might want to display a notification to the user or execute certain operations when the connection is lost or successfully restored.
Step 3: Modifying Logic with Event Subscription
To adjust the default behavior, follow these steps to subscribe to the events and implement your customized logic:
Add return true;
within each event handler to ensure your custom logic is utilized:
vnc.onConnectionLost = function (jData) {
// -- TO CUSTOMIZE
helper.console.log("onConnectionLost", arguments);
return true;
};
vnc.onConnectionRestored = function (jData) {
// -- TO CUSTOMIZE
helper.console.log("onConnectionRestored", arguments);
return true;
};
- Ensure that
return true;
is included at the conclusion of each handler. This step is crucial for preventing the default handling mechanism or for the disableDisplayWhileReconnecting
setting to be respected.
By carefully following these steps, you can effectively manage connection disruptions, providing a more resilient and user-friendly application environment.
Related Articles
What's New on Thinfinity Remote Workspace 8
Introduction Welcome to our comprehensive guide to the Thinfinity® Workspace 8. This article will introduce you to the product's groundbreaking features, new connection protocols, and enhanced user experience. Thinfinity Workspace 8 is the epitome of ...
How to Create Your First RDP Connection Using Thinfinity as a Jump Server
Introduction Welcome to this comprehensive guide designed to facilitate the setup of your initial RDP connection using Thinfinity® Workspace. Within this guide, we'll provide a detailed walkthrough on configuring Thinfinity Workspace as a jump ...
How to Create Your First RDP Connection Terminal Server (Local Host)
Introduction Welcome to this comprehensive guide, specifically designed to streamline the setup of your initial RDP connection using Thinfinity® Workspace. This tutorial focuses on creating an RDP connection on the same server where Thinfinity ...
How to Create an RDP Connection Using Agent mode in Thinfinity Workspace
Introduction This document will guide you through the process of configuring an RDP connection using Agent mode. The Workspace Agent provides a convenient solution for establishing Remote Desktop Protocol (RDP) connections without opening inbound ...
How to Enable H264 in Thinfinity Workspace
Product: Thinfinity Workspace Version: 7 and later Introduction H264 is the most widely used format for efficiently capturing, compressing, and distributing high-quality video content. As such, Thinfinity Workspace must work with H264 to provide a ...