Provides an implementation of Distant Werkout to be used in the main process of an Electron application. This implementation handles IPC messages from the Renderer process as follows:
- procures Electron window
- Message of type 'main' is sent to Renderer with the following payload:
- { type: 'info', data: 'Ack' }
- Message is forwarded to the remote application
- Message is forwarded to the remote application
- Message is forwarded to the remote application
- Message is forwarded to the remote application
- VDI initialization is requested (virtual channel is opened and controller is created)
- Message of type 'setupVDIFinished' is sent to Renderer with the following payload:
- { type: 'info', initialized: , moduleName: }
- A new session is requested with the ID provided
- A close session request will be issued for a session matching the ID provided
- Message is forwarded to the remote application as type 'reload'
- Distant sessions are closed
- Virtual channel handle is destroyed
- Electron application exits
- Accepts an object with a 'name' property
- Sends an IPC message of event 'getChannelFinish' with the Virtual Channel handle matching the name
- Forwards test results to the Distant Werkout Daemon
- Allows for test results to be sent to the Werkout server through the Distant Werkout Daemon's partner state
- Shuts down VDI:
- close all sessions
- destroy handle to virtual channel
- Sends a 'shutdownFinish' message to the renderer process
const main = require('distant-werkout-main')
const url = 'https://example/my/remote/application'
const distantWerkoutMain = main(url)