Forked from https://github.com/fraunhoferfokus/peer-ssdp with the following changes:
v0.1.0:
- Add
bindToInterfaces
and bindToAddresses
options.
- Based on upstream v0.0.5.
Everything else is the original author's work.
peer-ssdp
peer-ssdp is a simple Node.js module implementing the Simple Service Discovery Protocol SSDP as described in the
UPnP Device Architecture specification, Section 1
Setup
- use
npm install peer-ssdp
to install the module.
- run example with
node node_modules/peer-ssdp/test/ssdp-test.js
Usage
Peer is an EventEmitter
so you can use the common EventEmitter
API to subscribe to specific events.
var ssdp = require("peer-ssdp");
var peer = ssdp.createPeer();
var interval;
peer.on("ready",function(){
interval = setInterval(function(){
peer.alive({
ST: "upnp:rootdevice",
SERVER: "...",
ST: headers.ST,
USN: "...",
LOCATION: "http://{{networkInterfaceAddress}}/device-desc.xml",
});
}, 1000);
setTimeout(function(){
clearInterval(interval);
peer.close();
}, 10000);
});
peer.on("notify",function(headers, address){
});
peer.on("search",function(headers, address){
peer.reply({
ST: "upnp:rootdevice",
SERVER: "...",
ST: headers.ST,
USN: "...",
LOCATION: "http://{{networkInterfaceAddress}}/device-desc.xml",
},address);
});
peer.on("found",function(headers, address){
});
peer.on("close",function(){
});
peer.start();
License
GNU Lesser General Public License v3.0, for more details please refer to the LICENSE file.
Contact us at famecontact@fokus.fraunhofer.de
Copyright (c) 2017 Fraunhofer FOKUS