-
-
Save ToeJamson/6938336 to your computer and use it in GitHub Desktop.
Node.js Quick Start
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 pub-key="demo" sub-key="demo" id="pubnub"></div> | |
| <script src="http://cdn.pubnub.com/pubnub-3.1.min.js"></script> | |
| <script>(function(){ | |
| // Listen For Events | |
| PUBNUB.subscribe({ | |
| channel : "hello_world", // Channel | |
| error : function() { // Lost Connection (auto reconnects) | |
| alert("Connection Lost. Will auto-reconnect when Online.") | |
| }, | |
| callback : function(message) { // Received An Event. | |
| alert(message.anything) | |
| }, | |
| connect : function() { // Connection Established. | |
| // Send Message | |
| PUBNUB.publish({ | |
| channel : "hello_world", | |
| message : { anything : "Hi from PubNub." } | |
| }) | |
| } | |
| }) | |
| })();</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment