/v2/history/sub-key/<sub-key>/channel/<channel>?URL_PARAMETERS
start (time token): Beginning of a timeline slice (exclusive)
| var pubnub = PUBNUB.init({ | |
| publish_key : '<PUBLISH_KEY>', | |
| subscribe_key : '<SUBSCRIBE_KEY>' | |
| }) | |
| pubnub.subscribe({ | |
| channel : "my_channel", | |
| message : function (message) { | |
| console.log("I got the message: " + message) | |
| }, |
| <div | |
| channel-name=notifications-channel | |
| segregate-notifications-by-page=false | |
| id=desktop-notifications-config | |
| ></div> | |
| <div id=pubnub pub-key=demo sub-key=demo></div> | |
| <script src=http://http://cdn.pubnub.com/pubnub-3.5.4.min.js></script> | |
| <script | |
| src=http://www.pubnub.com/static/html5-desktop-notification-broadcasting.js | |
| ></script> |
| <script src="http://cdn.pubnub.com/pubnub.min.js"></script> | |
| <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script> | |
| <script src="http://pubnub.github.io/angular-js/scripts/pubnub-angular.js"></script> |
| Enter Chat and press enter | |
| <div><input id=input placeholder=you-chat-here /></div> | |
| Chat Output | |
| <div id=box></div> | |
| <script src=http://cdn.pubnub.com/pubnub.min.js></script> | |
| <script>(function(){ | |
| var pubnub = PUBNUB.init({publish_key:'demo',subscribe_key:'demo',ssl:true}); | |
| var box = PUBNUB.$('box'), input = PUBNUB.$('input'), channel = 'chat'; |
| require "pubnub" | |
| -- | |
| -- GET YOUR PUBNUB KEYS HERE: | |
| -- http://www.pubnub.com/account#api-keys | |
| -- | |
| multiplayer = pubnub.new({ | |
| publish_key = "demo", -- YOUR PUBLISH KEY | |
| subscribe_key = "demo", -- YOUR SUBSCRIBE KEY | |
| secret_key = nil, -- YOUR SECRET KEY |
| // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | |
| // Geo Hash | |
| // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | |
| function geohash( coord, resolution ) { | |
| var rez = Math.pow( 10, resolution || 0 ); | |
| return Math.floor(coord * rez) / rez; | |
| } |
| topic = "user/path/topic" |
| <script type="text/javascript" src="js/PushNotification.js"></script> | |
| <script src="https://cdn.pubnub.com/sdk/javascript/pubnub.4.17.0.js"></script> |
| $('#toggle').click(function(e){ | |
| pubmsg = { "req" : "toggle" }; | |
| var publishConfig = { | |
| channel : 'gpio-raspberry-control', | |
| message : pubmsg | |
| } | |
| pubnub.publish(publishConfig, function(status, response) { | |
| console.log(status, response); |