TooTallNate / node-icy

Node.js module for parsing and/or injecting ICY metadata
MIT License
291 stars 48 forks source link

metadata event not being fired #21

Closed mmercedes closed 9 years ago

mmercedes commented 9 years ago

I've copy/pasted the example file into a working server and have confirmed the response headers are received (by the console.log(res.headers) line). However no metadata events are being triggered, even when I'm confident the stream is sending metadata. Below is the exact code I'm running

icy.get(url, function (res) {

  // log the HTTP response headers
  console.log(res.headers);

  // log any "metadata" events that happen
  res.on('metadata', function (metadata) {
    console.log(metadata);
    var parsed = icy.parse(metadata);
    console.log(parsed);
    io.sockets.emit("metadata", metadata);
  });
});
mmercedes commented 9 years ago

I realized the metadata event was not being fired due to me not pipeing the stream anywhere and therefore once the initial get request was complete, my connection to the stream was closed.