# upnp-device-client

> A simple and versatile UPnP device client

Latest version **1.0.2** (published 2016-03-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install upnp-device-client
pnpm add upnp-device-client
yarn add upnp-device-client
bun add upnp-device-client
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2016-03-30 |
| First published | 2014-10-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 34 |
| Author | thibauts |
| Maintainers | thibauts |
| Keywords | upnp, dlna |

## Links

- npm: https://www.npmjs.com/package/upnp-device-client
- Repository: https://github.com/thibauts/node-upnp-device-client
- Homepage: https://github.com/thibauts/node-upnp-device-client#readme
- Issues: https://github.com/thibauts/node-upnp-device-client/issues
- npm.io page: https://npm.io/package/upnp-device-client

## Dependencies (4)

- [debug](https://npm.io/package/debug.md) ^2.1.3
- [elementtree](https://npm.io/package/elementtree.md) ~0.1.6
- [concat-stream](https://npm.io/package/concat-stream.md) ^1.4.8
- [network-address](https://npm.io/package/network-address.md) ^1.0.0

## Recent versions

- 1.0.2 (latest) — 2016-03-30
- 1.0.1 — 2016-03-15
- 1.0.0 — 2015-04-18
- 0.0.7 — 2015-02-26
- 0.0.6 — 2014-12-18
- 0.0.5 — 2014-12-18
- 0.0.4 — 2014-12-18
- 0.0.3 — 2014-12-18
- 0.0.2 — 2014-10-21
- 0.0.1 — 2014-10-21

## README

upnp-device-client
==================
### A simple and versatile UPnP device client

This module can query UPnP devices descriptions, service descriptions and call actions on services. It also provides a simple interface to subscribe to UPnP services events.

Install
-------

```bash
$ npm install upnp-device-client
```

Usage
-----

```javascript
var Client = require('upnp-device-client');

// Instanciate a client with a device description URL (discovered by SSDP)
var client = new Client('http://192.168.1.50:4873/foo.xml');

// Get the device description
client.getDeviceDescription(function(err, description) {
  if(err) throw err;
  console.log(description);
});

// Get the device's AVTransport service description
client.getServiceDescription('AVTransport', function(err, description) {
  if(err) throw err;
  console.log(description);
});

// Call GetMediaInfo on the AVTransport service
client.callAction('AVTransport', 'GetMediaInfo', { InstanceID: 0 }, function(err, result) {
  if(err) throw err;
  console.log(result); // => { NrTracks: '1', MediaDuration: ... }
});

client.subscribe('AVTransport', function(e) {
  // Will receive events like { InstanceID: 0, TransportState: 'PLAYING' } when playing media
  console.log(e); 
});

// client.unsubscribe('AVTransport', listener);
```

Run with debug traces

```bash
$ DEBUG=* node index.js
```

---
_Source: https://npm.io/package/upnp-device-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
