freeCodeCamp/coderadio-client

switch to Live Websocket/EventSource

Closed this issue · 0 comments

we are currently using Static Now Playing JSON File to get the mount. we should switch to Live Websocket/EventSource

https://www.azuracast.com/developers/nowplaying.html#standard-now-playing-api

here is a sample:

    var sub = new NchanSubscriber('https://coderadio-admin.freecodecamp.org/api/live/nowplaying/1');

    sub.on("message", function(message, message_metadata) {
       console.log( JSON.parse(message));
    });
    sub.start();

we should work with the message
more detail on https://github.com/slact/nchan.js/blob/master/NchanSubscriber.js