Created
May 1, 2012 20:42
-
-
Save latentflip/2571207 to your computer and use it in GitHub Desktop.
shakey-blog-1
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
game_server.html | |
<script src="http://js.pusher.com/1.12/pusher.min.js"> | |
</script> | |
<script> | |
//setup pusher and a presence channel | |
pusher = new Pusher('pusher-key') | |
channel = pusher.subscribe('presence-main-channel') | |
//listen to "client-alert-message" messages on the | |
//channel, and alert with the message text | |
channel.on('client-alert-message', function(data) { | |
alert(data.message_text); | |
}); | |
</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
game_client.html | |
<script src="http://js.pusher.com/1.12/pusher.min.js"> | |
</script> | |
<script> | |
//same setup | |
pusher = new Pusher('secret-pusher-key') | |
channel = pusher.subscribe('presence-main-channel') | |
//listen to "client-alert-message" messages on the | |
//channel, and alert with the message text | |
channel.trigger('client-alert-message', { | |
message_text: "Hello, world!" | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment