A node.js SSDP client and server library.
npm install node-ssdp
There is another package called
ssdp which is the original unmaintained version. Make sure to install
var Client = require'node-ssdp'Clientclient = ;clienton'response'console.log'Got a response to an m-search.';;// search for a service typeclientsearch'urn:schemas-upnp-org:service:ContentDirectory:1';// Or get a list of all services on the networkclientsearch'ssdp:all';
var Server = require'node-ssdp'Serverserver =;serveraddUSN'upnp:rootdevice';serveraddUSN'urn:schemas-upnp-org:device:MediaServer:1';serveraddUSN'urn:schemas-upnp-org:service:ContentDirectory:1';serveraddUSN'urn:schemas-upnp-org:service:ConnectionManager:1';serveron'advertise-alive'// Expire old devices from your cache.// Register advertising device somewhere (as designated in http headers heads);serveron'advertise-bye'// Remove specified device from cache.;// start the serverserverstart;processon'exit'serverstop // advertise shutting down and stop listening
Take a look at
example directory as well to see examples or client and server.
##Configuration SSDP constructor accepts an optional configuration object. At the moment, the following is supported:
logBoolean Enable/disable logging. Default: false.
logLevelString Specifies log level to print. Possible values:
FATAL. If not explicitly set in options logging is disabled completely.
ssdpSigString SSDP signature. Default: 'node.js/0.0.8 UPnP/1.1 node-ssdp/0.1.1'
ssdpIpString SSDP multicast group. Default: '220.127.116.11'
ssdpPortNumber SSDP port. Default: 1900
ssdpTtlNumber Multicast TTL. Default: 1
advertiseevent frequency (ms)
unicastHostString IP address or hostname of server where SSDP service is running. This is used in
locationString URL pointing to description of your service
udnString Unique Device Name. Defaults to "uuid:f40c2981-7329-40b7-8b04-27f187aecfb5".
descriptionString Path to description file. Defaults to "upnp/desc.php".
ttlNumber Packet TTL. Default: 1800.
(The MIT License)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.