Permalink
Browse files

listening in the browser

  • Loading branch information...
CrowdHailer committed May 28, 2018
1 parent a50bf80 commit ae199c806a5d166f76aedeb67291e46dd331eaad
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/watercooler/public/main.js
@@ -1 +1,9 @@
console.log("Hello")
var $message = document.getElementById('messages') // 1.
displayUpdate = function (update) { // 2.
var line = "<li>" + update.data +"</li>"
$message.innerHTML = line + $message.innerHTML
}
var source = new EventSource('/listen'); // 3.
source.onmessage = displayUpdate // 4.

0 comments on commit ae199c8

Please sign in to comment.