All you need to interact with Xively
- lightweight~ 2kb gzipped
- completewith all API methods
- extendedmethods for ease of use
Download
Include the file
// Include after jQuery (required)
<script src="http://d23cj0cdvyoxg0.cloudfront.net/xivelyjs-1.0.4.min.js"></script>
Sample usage
// Set your API key first
xively.setKey( "YOUR_KEY_HERE" );
// Get feed content
xively.feed.get( "504", function( data ) {
console.log( data.title ); // Logs the feed title
});
// Get realtime updates on a datastream
xively.datastream.subscribe( "61916", "sine60", function( event, data ) {
console.log( data.current_value ); // Logs value changes in realtime
});
jQuery Plugin
// Set current value on elements
$('.datastream-value').xively('get', { feed: 61916, datastream: 'sine60' });
// Set and update value in realtime
$('.datastream-value').xively('live', { feed: 61916, datastream: 'sawtooth60' });
Quick Demo
Pro Tip: Stream your CPU stats from your Mac to Xively with iXively