@rbbn/distant-werkout-vdi

1.2.0 • Public • Published

Distant Werkout VDI

High level management of VDI capabilities. These include:

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

Usage

const { VDI } = require('distant-werkout-vdi')

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

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

async function setup() {
  // Create instance
  const vdi = vdi = new VDI(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()
}

Readme

Keywords

none

Package Sidebar

Install

npm i @rbbn/distant-werkout-vdi

Weekly Downloads

2

Version

1.2.0

License

SEE LICENSE IN LICENSE.md

Unpacked Size

9.5 kB

Total Files

5

Last publish

Collaborators

  • rbbn-webrtc-distant