This file contains hidden or 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: protocol.CHANNEL, | |
| callback: this.handleSignal.bind(this), | |
| presence: this.handlePresence.bind(this) | |
| }); | |
| handlePresence: function (msg) { | |
| var conn = this.connections[msg.uuid]; | |
| if (conn) { | |
| // Pass the message to specific contact/connection |
This file contains hidden or 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
| (void)pubnubClient:(PubNub *)client didReceiveMessage:(PNMessage *)message { | |
| NSMutableDictionary *groupMessages = [[NSMutableDictionary alloc] init]; | |
| [groupMessages setDictionary: [[Globals sharedInstance] groupMess]]; | |
| NSMutableDictionary *nameDict = [[NSMutableDictionary alloc] init]; | |
| [nameDict setDictionary: [[Globals sharedInstance] nameDict]]; | |
| NSMutableString *groupName = [[NSMutableString alloc] init]; | |
This file contains hidden or 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 : 'my_test_channel' }, | |
| function(message) { | |
| if ('some_text' in message) { | |
| alert(message.some_text); | |
| } | |
| } ); |
This file contains hidden or 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
| <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://cdn.pubnub.com/pubnub-3.1.min.js></script> | |
| <script src=http://www.pubnub.com/static/html5-desktop-notification-broadcasting.js></script> |
This file contains hidden or 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
| navigator.geolocation.getCurrentPosition(function (position) { | |
| console.log(“I am located at: “ + position.coords.latitude + “, “ + position.coords.longitude); | |
| }); | |
| navigator.geolocation.watchPosition(function (position) { | |
| console.log(“I am now located at: “ + position.coords.latitude + “, “ + position.coords.longitude); | |
| }); |
This file contains hidden or 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
| private void HandleMessage(string json) { | |
| Dictionary<string, string> message = ParseJson(json); | |
| Dictionary<string, string> response = new Dictionary<string, string>90; | |
| response["type"] = message["type"]; | |
| switch (message["type"]) { | |
| case "login": | |
| if (authorized(message["user"])) { | |
| response["sucess"] = true; | |
| } | |
| break; |
This file contains hidden or 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
| void setup() { | |
| Serial.begin(9600); | |
| Ethernet.begin(mac); | |
| PubNub.begin(pubkey, subkey); | |
| } | |
| void loop() { | |
| /* Maintain DHCP lease. */ | |
| Ethernet.maintain(); |
This file contains hidden or 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
| DELIMITER $$ | |
| CREATE PROCEDURE push_message | |
| (p1 DOUBLE, | |
| p2 DOUBLE, | |
| p3 BIGINT) | |
| BEGIN | |
| DECLARE cmd CHAR(255); | |
| DECLARE result CHAR(255); | |
| SET cmd = CONCAT('curl https://pubsub.pubnub.com/publish/demo/demo/0/mysql_triggers/0/%22',p1, ',' ,p2, ',' ,p3,'%22'); | |
| SET result = sys_eval(cmd); |
This file contains hidden or 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
| {"Depositor":"Randy","Amount":123.00} |
This file contains hidden or 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
| [sender addObserver: self | |
| forKeyPath:key | |
| options:NSKeyValueObservingOptionNew | |
| context:NULL]; |