Created
March 4, 2016 21:23
-
-
Save ProbablePrime/65ec4eacfe159fcfa6cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Client = require('wsabi-client-bacon'); | |
var client = new Client("wss://realtime.beam.pro"); | |
client.socket.on("open", function () { | |
console.log("Socket connection open!"); | |
// Send requests to the server with get, put, post, delete, or request. | |
client.get("/api/v1/channels/Youplay").then(function(res) { | |
// Subscribe to a live event | |
client.live('channel:'+res.id+':update').then(function(res) { | |
res.onValue(function(value){ | |
console.log(value.viewersCurrent); | |
}); | |
}); | |
}, function(res){ | |
console.log(arguments); | |
console.log(res); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment