Update gophers example.

This commit is contained in:
Ola
2022-09-14 15:34:50 +02:00
parent fdfd3d60e4
commit f46f868ce3
5 changed files with 85 additions and 31 deletions
+2 -2
View File
@@ -22,7 +22,7 @@
<script>
var url = "ws://" + window.location.host + "/ws";
var ws = new WebSocket(url);
var myid = -1;
var myid = "";
ws.onmessage = function (msg) {
var cmds = {"iam": iam, "set": set, "dis": dis};
@@ -60,7 +60,7 @@
}
window.onmousemove = function (e) {
if (myid > -1) {
if (myid !== "") {
set(myid, e.pageX, e.pageY);
ws.send([e.pageX, e.pageY].join(" "));
}