node-upnp

1.2.0 • Public • Published

Modern UPnP Client Library

NPM Version NPM Downloads

Modern UPnP client with async/await support and sane extensible codebase.

Install

npm i node-upnp

Usage

const UPnPClient = require('node-upnp');
 
const client = new UPnPClient({
  url: 'http://192.168.1.150:44042/some.xml'
});
 
const desc = await client.getDeviceDescription();
console.log('Device', desc);

API

async getDeviceDescription()

returns device description

async getServiceDescription(serviceId)

returns service description

async call(serviceId, actionName, data)

calls actionName for serviceId with data and return a result

async subscribe(serviceId, listener)

subscribes for serviceId service updates. Keeps the subsription alive.

async unsubscribe(serviceId, listener)

unsubscribes from serviceId service updates.

hasSubscriptions()

returns true/false is the client has any active subscriptions

clearSubscriptions()

clears all subscriptions

async on(variable, listener, options = {})

subscribes on the variable change event. Options:

  • force — Boolean, when true, subscribes on the service even if variable is sendEvents='no' in the service description. This options is for variable included in LastChange event.

async off(variable, listener)

emit(...args)

async removeAllListeners()

License MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.2.0
    61
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.2.0
    61
  • 1.1.1
    0
  • 1.1.0
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i node-upnp

Weekly Downloads

61

Version

1.2.0

License

MIT

Unpacked Size

25.2 kB

Total Files

14

Last publish

Collaborators

  • velocityzen