Created
March 8, 2012 10:00
-
-
Save technovangelist/2000067 to your computer and use it in GitHub Desktop.
Pusher Test Client Web Page
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
$('#InputText').on 'change', -> | |
inputText = $(@) | |
$.ajax("http://localhost:8888/chat?from=#{$('#Name').val()}&content=#{inputText.val()}") | |
inputText.val('') | |
pusher = new Pusher('Get Your Own Key at Pusher.com') | |
channel = pusher.subscribe('ChatChannel') | |
channel.bind('chat', (data)->$('#OutputText').prepend("#{data.from} said #{data.content} <br>")) |
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Pusher Test</title> | |
</head> | |
<body> | |
Name: <input type="text" id="Name"><br> | |
<input type="text" id="InputText" style="width:500px"><br> | |
<div id="OutputText"></div> | |
<script src="jquery.js"></script> | |
<script src="http://js.pusher.com/1.11/pusher.min.js"></script> | |
<script src="pusher.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment