diff --git a/chat-app/static/index.html b/chat-app/static/index.html index 3e38662..da07796 100644 --- a/chat-app/static/index.html +++ b/chat-app/static/index.html @@ -9,12 +9,21 @@ diff --git a/chat-app/static/js/chat-service.js b/chat-app/static/js/chat-service.js index e8ddd0d..37d598a 100644 --- a/chat-app/static/js/chat-service.js +++ b/chat-app/static/js/chat-service.js @@ -1,3 +1,5 @@ +const ws = initChatService(); + function initChatService() { const ws = new WebSocket("ws://localhost:3000/chat-socket"); @@ -14,4 +16,6 @@ function initChatService() { ws.onerror = function (event) { console.log(event); }; + + return ws; }