diff --git a/go-socket b/go-socket index 30b4ec9..7a7816d 100755 Binary files a/go-socket and b/go-socket differ diff --git a/http.go b/http.go index 965e8fa..71ef995 100644 --- a/http.go +++ b/http.go @@ -249,6 +249,7 @@ func HttpHandleUserMessage(response http.ResponseWriter, request *http.Request) } WsSendToUser(user, target, message) + response.WriteHeader(http.StatusAccepted) } func HttpHandleUserNewConnection(response http.ResponseWriter, request *http.Request) { diff --git a/machine-client/index.html b/machine-client/index.html index 26f5d22..ec5b9e7 100644 --- a/machine-client/index.html +++ b/machine-client/index.html @@ -386,7 +386,9 @@ function wsAuth() { if (!ws) { log('WS', 'not connected', 'log-err'); return; } - const token = document.getElementById('ws-token').value; + const el = document.getElementById('ws-token'); + const token = el ? el.value : currentToken; + if (!token) { log('WS', 'no token to auth with', 'log-err'); return; } const msg = JSON.stringify({ token }); ws.send(msg); log('WS →', msg, 'log-info');