@rbbn/distant-manager

1.0.0 • Public • Published

Distant Manager

High level management of Distant VDI capabilities. These include:

  • Creating Distant Controllers
  • Managing Virtual Channels
  • Creating Distant Sessions
  • Sending messages to a Distant Session

Usage (Main process)

const { DistantManager } = require('distant-manager')

const moduleName = 'vdiModule'
const url = 'https://example/my/remote/application'
const id = 123

function handleVDIMessage(type, data) {
  ...
}

async function setup() {
  // Create instance
  const vdi = new DistantManager(url, moduleName, handleVDIMessage)

  // Create channel handle and Distant Controller
  await this.vdi.init()

  // Create session with automatic event handling
  // `handleVDIMessage()` will receive messages of type `sessionInfo`, `sdkMessage` and `logMessage`
  await vdi.createSessionWithEventHandling(id)

  // Send a message to the remote application
  vdi.sendSessionMessage(id, 'sdkMessage', { data: 'hello' })

  // Create another session with a different remote application URL and specific timeout value
  const differentID = 456
  const differentURL = 'https://different/url/for/remote/application'
  const timeout = 3000

  await vdi.createSessionWithEventHandling(differentID, differentURL, timeout)

  // Close session by ID
  vdi.closeSession(id)

  // Shut down: close all sessions, destroy channel handle and destroy Distant Controller
  await vdi.close()
}

Usage (Renderer process)

const electron = require('electron')

electron.ipcRenderer.on('sessionInfo', (event, session) => { ... })
electron.ipcRenderer.on('sessionClosed', (event, session) => { ... })


Readme

Keywords

none

Package Sidebar

Install

npm i @rbbn/distant-manager

Weekly Downloads

83

Version

1.0.0

License

SEE LICENSE IN LICENSE.md

Unpacked Size

8.72 kB

Total Files

4

Last publish

Collaborators

  • rbbn-webrtc-distant