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 pubnub = PUBNUB.init({ | |
publish_key : 'pub-c-df94b72e-7d48-4df1-8876-2cccc1afe0f8', | |
subscribe_key : 'sub-c-c5b3ec0c-d248-11e4-95a3-0619f8945a4f', | |
ssl : (('https:' == document.location.protocol) ? true : false) | |
}); | |
function rand(len){ | |
var text = ""; | |
var charset = "abcdefghijklmnopqrstuvwxyz0123456789"; | |
for( var i=0; i < len; i++ ) { |
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
require('antigravity'); |
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
<!-- Include the PubNub Library --> | |
<script src="https://cdn.pubnub.com/pubnub-ds-b2.js"></script> | |
<!-- Instantiate PubNub --> | |
<script type="text/javascript"> | |
var PUBNUB_demo = PUBNUB.init({ | |
publish_key: 'Your Publish Key Here', | |
subscribe_key: 'Your Subscribe key Here' | |
}); |
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
<!-- Include the PubNub Library --> | |
<script src="https://cdn.pubnub.com/pubnub.min.js"></script> | |
<!-- Instantiate PubNub --> | |
<script type="text/javascript"> | |
var PUBNUB_demo = PUBNUB.init({ | |
publish_key: 'Your Publish Key Here', | |
subscribe_key: 'Your Subscribe key Here', | |
secret_key: 'Your Secret key Here' |
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
home.on.ready(function(){ | |
syncDoor(); | |
syncLight(); | |
syncMusic(); | |
}); | |
home.on.change(function(ref){ | |
syncDoor(); | |
syncLight(); | |
syncMusic(); |
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
pubnub.audit({ | |
channel: 'Your_Channel_Name', | |
callback: function(m){ | |
console.log(m); | |
} | |
}); |
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
<!-- Include the PubNub Library --> | |
<script src="https://cdn.pubnub.com/pubnub.min.js"></script> | |
<!-- Instantiate PubNub --> | |
<script type="text/javascript"> | |
var PUBNUB_demo = PUBNUB.init({ | |
publish_key: 'Your Publish Key Here', | |
subscribe_key: 'Your Subscribe key Here' | |
}); |
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
PUBNUB_demo.history({ | |
channel : 'demo_tutorial', | |
count : 100, | |
callback : function(m){console.log(m)} | |
}); |
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
pubnub.subscribe({ | |
channel: channel, | |
// Add presence | |
presence: function(m){ | |
document.getElementById('occupancy').textContent = m.occupancy; | |
} | |
}); |
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
PUBNUB.publish({ | |
channel : 'mouseMoves', | |
message : { | |
x: 400, | |
y: 200 | |
} | |
}); |
NewerOlder