Nodejs implementation of the UPnP Device Architecture 1.1
peer-upnp is a Node.js module implementing the UPnP protocol as described in the UPnP Device Architecture specification
npm install peer-upnpto install the module.
node node_modules/peer-upnp/test/binary-light-device.jsto create and advertise a UPnP
node node_modules/peer-upnp/test/binary-light-client.jsthat discovers
BinaryLightdevices and uses
SwitchPowerService to control the light.
node node_modules/peer-upnp/test/upnp-test.jsto discover UPnP services on the network.
The following example shows the discovery and binding process of UPnP devices and services.
var upnp = ;var http = ;var server = http;var PORT = 8080;server;// Peer is an event emittervar peer = upnp;
The following example shows how to create and advertise a BinaryLight device and with a SwitchPower service as specified in UPnP Lighting Controls V 1.0. Please refer to the documentation in the code.
var upnp = ;var http = ;var server = http;var PORT = 8080;// start server on port 8080. please do this step before you create a peerserver;// Create a UPnP Peer.var peer = upnpstart;// Create a BinaryLight device as specified in UPnP .// Please refer for device configuration parameters to the UPnP device architecture.var device = peer;// create a SwitchPower service in the BinaryLight device as specified herevar service = device;// initialize the Target State Variable with 0service;
Free for non commercial use released under the GNU Lesser General Public License v3.0, See LICENSE file.
Contact us for commecial use firstname.lastname@example.org
Copyright (c) 2013 Fraunhofer FOKUS