A NodeJS wrapper for the listen.moe WebSocket.
npm install listenmoe.js
const ListenMoeJS = require('listenmoe.js');
// For the jpop WebSocket you can also leave the parameters empty
const moe = new ListenMoeJS('jpop'); // or "kpop" if you want the trackdata from there
moe.on('updateTrack', (data) => { // When listen.moe updates the track
// Do something with it
});
moe.on('error', (error) => { // Handle any thrown errors
// Handle it or ignore
});
moe.connect(); // Connect to the WebSocket
moe.getCurrentTrack() // Returns the current track (or null if there is none)
moe.fetchTrack() // Send a track update request to receive the newest data
.then(t => {
// Do something with it
}).catch(e => {
// Handle it or ignore
}):
Refer to the LICENSE file.