forked from mirror/websocket
parent
c93e5540b8
commit
361d4c0ffd
|
@ -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.
|
||||
|
|
|
@ -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) {
|
|||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<table>
|
||||
<tr><td valign="top" width="50%">
|
||||
<p>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.
|
||||
<p>
|
||||
<form>
|
||||
<button id="open">Open</button>
|
||||
<button id="close">Close</button>
|
||||
<p><input id="input" type="text" value="Hello world!">
|
||||
<button id="send">Send</button>
|
||||
</form>
|
||||
</td><td valign="top" width="50%">
|
||||
<div id="output"></div>
|
||||
</td></tr></table>
|
||||
</body>
|
||||
</html>
|
||||
`))
|
||||
|
|
Loading…
Reference in New Issue