1 function displayMessage(data) {
2 console.log("received message");
6 function installWebsocket() {
7 // TODO: Don't hardcode the websocket path; pull it from the DOM
8 var ws = new WebSocket("ws://127.0.0.1:8888");
9 ws.onmessage = function(evt) {
10 displayMessage(evt.data);
12 ws.onopen = function() {
13 console.log("connected");
14 ws.send("Hello, there!");
16 ws.onclose = function () {
17 console.log("closed websocket");
21 window.onload = function () {