{"id":13583340,"url":"https://github.com/diversario/node-ssdp","last_synced_at":"2025-05-16T08:06:03.342Z","repository":{"id":5116657,"uuid":"6280923","full_name":"diversario/node-ssdp","owner":"diversario","description":"node.js SSDP client/server.","archived":false,"fork":false,"pushed_at":"2023-04-06T12:12:47.000Z","size":279,"stargazers_count":273,"open_issues_count":21,"forks_count":120,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-05-17T04:43:58.068Z","etag":null,"topics":["javascript","node-ssdp","packets","ssdp","ssdp-service"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"XiaoMi/open-falcon","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/diversario.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2012-10-18T15:30:11.000Z","updated_at":"2024-02-13T17:01:48.000Z","dependencies_parsed_at":"2023-07-06T19:01:55.516Z","dependency_job_id":null,"html_url":"https://github.com/diversario/node-ssdp","commit_stats":{"total_commits":153,"total_committers":25,"mean_commits":6.12,"dds":0.5620915032679739,"last_synced_commit":"7787063a26915f7aa42806484b26265333745962"},"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diversario%2Fnode-ssdp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diversario%2Fnode-ssdp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diversario%2Fnode-ssdp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diversario%2Fnode-ssdp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diversario","download_url":"https://codeload.github.com/diversario/node-ssdp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254493378,"owners_count":22080126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","node-ssdp","packets","ssdp","ssdp-service"],"created_at":"2024-08-01T15:03:24.758Z","updated_at":"2025-05-16T08:05:58.333Z","avatar_url":"https://github.com/diversario.png","language":"JavaScript","readme":"[![Build Status](https://travis-ci.org/diversario/node-ssdp.svg?branch=master)](https://travis-ci.org/diversario/node-ssdp)\n[![Coverage Status](https://img.shields.io/coveralls/diversario/node-ssdp.svg)](https://coveralls.io/r/diversario/node-ssdp?branch=master)\n[![Dependency Status](https://gemnasium.com/diversario/node-ssdp.png)](https://gemnasium.com/diversario/node-ssdp)\n[![NPM version](https://badge.fury.io/js/node-ssdp.svg)](http://badge.fury.io/js/node-ssdp)\n\n## Installation\n\n```sh\nnpm install node-ssdp\n```\n\nThere is another package called `ssdp` which is the original unmaintained version. Make sure to install `node-ssdp` instead.\n\n## Usage - Client\n\n```javascript\n    var Client = require('node-ssdp').Client\n      , client = new Client();\n\n    client.on('response', function (headers, statusCode, rinfo) {\n      console.log('Got a response to an m-search.');\n    });\n\n    // search for a service type\n    client.search('urn:schemas-upnp-org:service:ContentDirectory:1');\n\n    // Or get a list of all services on the network\n\n    client.search('ssdp:all');\n```\n\n## Usage - Server\n\n```javascript\n    var Server = require('node-ssdp').Server\n      , server = new Server()\n    ;\n\n    server.addUSN('upnp:rootdevice');\n    server.addUSN('urn:schemas-upnp-org:device:MediaServer:1');\n    server.addUSN('urn:schemas-upnp-org:service:ContentDirectory:1');\n    server.addUSN('urn:schemas-upnp-org:service:ConnectionManager:1');\n\n    server.on('advertise-alive', function (headers) {\n      // Expire old devices from your cache.\n      // Register advertising device somewhere (as designated in http headers heads)\n    });\n\n    server.on('advertise-bye', function (headers) {\n      // Remove specified device from cache.\n    });\n\n    // start the server\n    server.start();\n\n    process.on('exit', function(){\n      server.stop() // advertise shutting down and stop listening\n    })\n```\n\nTake a look at `example` directory as well to see examples or client and server.\n\n## Configuration\n\n### Client\n\n```\nconst Client = require('node-ssdp').Client\nconst client = new Client({...})\n```\n\n- `interfaces` _String[]_ List of interfaces to explicitly bind. By default, bind to all available interfaces.\n- `explicitSocketBind` _Boolean_ Bind sockets to each discovered interface explicitly instead of relying on the system. Might help with issues with multiple NICs.\n- `customLogger` _Function_ A logger function to use instead of the default. The first argument to the function can contain a format string.\n- `reuseAddr` _Boolean_ When true `socket.bind()` will reuse the address, even if another process has already bound a socket on it. Default: `true`\n\n### Server\n\n```\nconst Server = require('node-ssdp').Server\nconst server = new Server({...})\n```\n\n- `location` _String_ URL pointing to description of your service, or a function which returns that URL\n- `location` _Object_ For cases where there are multiple network interfaces or IP of the host isn't known in advance, it's possible to specify location as an object. Host will be set to the IP of the responding interface.\n  - `location.protocol` _String_ Location protocol, defaults to `http://`\n  - `location.port` _Number_ Location port. No default.\n  - `location.path` _String_ Location path. No default.\n- `udn` _String_ Unique Device Name. Default: `uuid:f40c2981-7329-40b7-8b04-27f187aecfb5`.\n- `allowWildcards` _Boolean_ Accept wildcards (`*`) in `serviceTypes` of `M-SEARCH` packets, e.g. `usn:Belkin:device:**`. Default: `false`\n- `interfaces` _String[]_ List of interfaces to explicitly bind. By default, bind to all available interfaces.\n- `explicitSocketBind` _Boolean_ Bind sockets to each discovered interface explicitly instead of relying on the system. Might help with issues with multiple NICs.\n- `customLogger` _Function_ A logger function to use instead of the default. The first argument to the function can contain a format string.\n- `suppressRootDeviceAdvertisements` _Boolean_ When true the SSDP server will not advertise the root device (i.e. the bare UDN). In some scenarios this advertisement is not needed. Default: `false`\n- `reuseAddr` _Boolean_ When true `socket.bind()` will reuse the address, even if another process has already bound a socket on it. Default: `true`\n- `adInterval` _Number_ `advertise` event frequency (ms). Default: 10 sec.\n- `ttl` _Number_ Packet TTL. Default: `1800`.\n\n### SSDP configuration:\n- `ssdpSig` _String_ SSDP signature. Default: `node.js/NODE_VERSION UPnP/1.1 node-ssdp/PACKAGE_VERSION`\n- `ssdpIp` _String_ SSDP multicast group. Default: `239.255.255.250`.\n- `ssdpPort` _Number_ SSDP port. Default: `1900`\n- `ssdpTtl` _Number_ Multicast TTL. Default: `4`\n\n\n### Logging\n\nYou can enable logging via an environment variable `DEBUG`. Set `DEBUG=node-ssdp:*` to enable all logs. To enable only client or server logs, use\n`DEBUG=node-ssdp:client` or `DEBUG=node-ssdp:server` respectively.\n\nAlternatively, you can provide your own `customLogger` function, in which case the `DEBUG` environment variable will be ignored.\n\n# License\n\n(The MIT License)\n\nPermission 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:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE 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.\n\n[![Analytics](https://ga-beacon.appspot.com/UA-51511945-1/node-ssdp/README.md)](https://github.com/igrigorik/ga-beacon)\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiversario%2Fnode-ssdp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiversario%2Fnode-ssdp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiversario%2Fnode-ssdp/lists"}