This is a Global Input App(GIA) WebSocket server, responsible for routing encrypted messages between device applications, and is one of the constituent parts of the GIA mobile integration solution. The Global Input App(GIA) with its extensions provides a universal mobile integration solution for web and device applications, allowing users to use mobiles to operate on those applications, and provides the following functionalities:
- Mobile Authentication
- Mobile Input & Control
- Second Screen Experience
- Mobile Personal Storage
- Mobile Encryption & Signing
- Mobile Content Transfer
Download the Node.JS application and its dependencies :
git clone https://github.com/global-input/global-input-node.git cd global-input-node cd app npm installOpen the configuration file /app/config/config.json, locate the url attribute:
.... "name":"default", "apikey":"k7jc3QcMPKEXGW5UC", "url":"https://node3.globalinput.co.uk" ... and modify its value to point to your own GIA WebSocket server instance. The URL is going to be used by both the application running on your device and the Global Input App running on your mobile, to connect to your WebSocket server instance. Hence, the URL should be reachable from the network that your devices are connected to. For example, if you use a URL with an internal network address, the device and your mobile should be connected to the same network.
run the Node application:
nodejs server.js This repository also contains the scripts for building the docker images for the WebSocket Server Container and the Nginx Reverse Proxy Container .
The details of the communication between the WebSocket server are encapsulated within the GIA extensions so that applications can just provide mobile user interfaces and callbacks to process mobile events. The GIA extensions are:
A GIA extension library connects to a GIA WebSocket server and displays an Encrypted QR Code to tell GIA how to connect to it. The URL of the WebSocket server and the APIKey value required connecting to the WebSocket server are contained in the Encrypted QR Code contains If you are using the GIA Chrome Extension, click on Communication Settings in the extension window. You can modify the WebSocket URL and the API key values that are used by the GIA Chrome extension to connect to the WebSocket server.
If you are using the GIA React Extension or the GIA JS Extension, you can set the URL and APIKey value of your WebSocket server in the mobile config:
let mobileConfig={ url:<url to your websocket server>, apikey:<apikey required for connection>, initData:{ form:{ ... } } Websockets are persistent contrary to those on the RestAPI calls. This means that a large number of connections needs to be kept open simultaneously. Although the workloads of processes are distributed across the nodes, the long-running WebSocket connections themselves will be increasing burden on the load balancer itself.
In the GIA WebSocket Loadbalancing Strategy, in order to resolve this limitation, every WebSocket session is started with an initial RestAPI call on the LoadBalancer to obtain the URL of a WebSocket Server node, so that the application will connect to the WebSocket node directly without going through the load balancer. The sequence of actions in the process for starting a WebSocket connection is shown in the following diagram: 