diaspora/public/javascripts/socket.js
2010-06-22 17:20:07 -07:00

14 lines
427 B
JavaScript

$(document).ready(function(){
function debug(str){ $("#debug").append("<p>" + str); };
ws = new WebSocket("ws://localhost:8080/");
ws.onmessage = function(evt) {
$("#stream").prepend($(evt.data).fadeIn("fast"));
};
ws.onclose = function() { debug("socket closed"); };
ws.onopen = function() {
debug("connected...");
//ws.send("hello server");
// ws.send("hello again");
};
});