From 361d4c0ffd78338ebe0a9e6320cdbe115d7dc026 Mon Sep 17 00:00:00 2001 From: Gary Burd Date: Mon, 2 Nov 2015 11:10:34 -0800 Subject: [PATCH] Improve echo web UI Based on feedback from anon. --- examples/echo/README.md | 4 +--- examples/echo/server.go | 14 +++++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/echo/README.md b/examples/echo/README.md index 14b5b09..6ad79ed 100644 --- a/examples/echo/README.md +++ b/examples/echo/README.md @@ -14,6 +14,4 @@ Next, start the client: $ go run client.go The server includes a simple web client. To use the client, open -http://127.0.0.1:8080 in the browser. Click "Open" to open a connection to the -server, "Send" to send a message to the server and "Close" to close the -connection. +http://127.0.0.1:8080 in the browser and follow the instructions on the page. diff --git a/examples/echo/server.go b/examples/echo/server.go index 53d21f6..a685b09 100644 --- a/examples/echo/server.go +++ b/examples/echo/server.go @@ -65,9 +65,9 @@ window.addEventListener("load", function(evt) { var ws; var print = function(message) { - var p = document.createElement("p"); - p.innerHTML = message; - output.appendChild(p); + var d = document.createElement("div"); + d.innerHTML = message; + output.appendChild(d); }; document.getElementById("open").onclick = function(evt) { @@ -112,13 +112,21 @@ window.addEventListener("load", function(evt) { + +
+

Click "Open" to create a connection to the server, +"Send" to send a message to the server and "Close" to close the connection. +You can change the message and send multiple times. +

+
+
`))