From afc63e1b90ed39bd6da5dc900563037219dee532 Mon Sep 17 00:00:00 2001 From: Vlad Date: Fri, 27 May 2016 21:40:11 +0300 Subject: [PATCH] Update url-address to connect to the WS server Connection address for WebSocket client has been changed from 'localhost' to 'window.location.hostname'. This allows the server work property with a non-local clients, right out of the box. --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index a3058a9..cc74695 100644 --- a/index.html +++ b/index.html @@ -28,7 +28,7 @@

Chat

chat.appendChild(line); } - var socket = new WebSocket('ws://127.0.0.1/chat'); + var socket = new WebSocket('ws://' + window.location.hostname + '/chat'); socket.onopen = function() { writeLine('connected'); @@ -44,4 +44,4 @@

Chat

- \ No newline at end of file +