diversario/node-ssdp

Why no notify event for the client?

cinhcet opened this issue · 4 comments

Hi,

in my understanding (maybe I'm wrong) of the UPnP specifications, a client, which is the control point, should be able to listen to ssdp:alive, ssdp:byebye and ssdp:update notifications from devices. In the /example/client.js there is such a "notify" event, which is, however, never be emitted?
Looking at the code, in the method SSDP.prototype._notify such events are handled.
So why does the following not work?

var SSDP = require('node-ssdp').Client;
var client = new SSDP();

client.on('advertise-alive', function (headers, rinfo) {
  console.log(headers);
  console.log(rinfo);
});

client.on('advertise-bye', function (headers, rinfo) {
  console.log(headers);
  console.log(rinfo);
});

Thanks!

+1, this doesn't appear to be working correctly. I also can't get the 'notify' event to fire (I'm monitoring with Wireshark and can confirm /NOTIFY multicast messages are being broadcast). The only event I've been able to get to fire is response.

Is it possible to view notifications and alive advertisements without explicitly calling client.search(...)? So far, the only SSDP messages I've been able to receive from the client are ones that I've explicitly triggered with an M-SEARCH request. I am interested in passively listening to service advertisements.

mroch commented

see my comment here: #95 (comment)

the client doesn't wait for responses before exiting. you can do something like var timeout = setTimeout(function() {}, 1000000) and clearTimeout(timeout) when you're ready to exit. or remove the socket.unref() in SSDP.prototype._createSockets, but I don't know what other ramifications that has.

Did you ever get this working?

I am also trying to get the notify (or advertise-bye, advertise-live) event firing on the client. I've added a timeout at the end of script to keep it alive for testing purposes but cannot get the events fired at all. M-SEARCH works fine.

I gave up and moved to dnssd2 it works.