Skip to content

Commit 427839f

Browse files
committed
examples/Websocket-Chat: Use hostname instead of local-only IP
1 parent cc92a79 commit 427839f

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

examples/Websocket-Chat/Websocket-Chat.ino

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,7 @@ void handleRoot(HTTPRequest * req, HTTPResponse * res) {
233233
" txtName.disabled = true;\n"
234234
" this.name = txtName.value;\n"
235235
" btnConnect.innerHTML = \"Connecting...\";\n"
236-
" this.ws = new WebSocket(\"wss://"
237-
);
238-
res->print(WiFi.localIP());
239-
res->print(
240-
"/chat\");\n"
236+
" this.ws = new WebSocket(\"wss://\" + document.location.host + \"/chat\");\n"
241237
" this.ws.onopen = e => {\n"
242238
" this.connecting = false;\n"
243239
" this.connected = true;\n"

0 commit comments

Comments
 (0)