Skip to content

Instantly share code, notes, and snippets.

@technovangelist
Created March 8, 2012 10:00
Show Gist options
  • Save technovangelist/2000067 to your computer and use it in GitHub Desktop.
Save technovangelist/2000067 to your computer and use it in GitHub Desktop.
Pusher Test Client Web Page
$('#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>"))
<!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