Verified Commit c78fa6af authored by Aral Balkan's avatar Aral Balkan
Browse files

Fix chat example so it works everywhere; not just on localhost

parent dd6a99b5
......@@ -523,7 +523,7 @@ module.exports = (request, response) => {
<h2>Messages</h2>
<ul id="messageList"></ul>
&lt;script&gt;</span><span class='language-js'>
const socket = new WebSocket("wss://localhost/chat")
const socket = new WebSocket(`wss://${window.location.hostname}/chat`)
const showMessage = message =&gt; {
const list = document.querySelector("#messageList")
......@@ -557,7 +557,7 @@ module.exports = (request, response) => {
&lt;h2&gt;Messages&lt;/h2&gt;
&lt;ul id="messageList"&gt;&lt;/ul&gt;
&lt;script&gt;</span><span class='language-js'>
const socket = new WebSocket("wss://localhost/chat")
const socket = new WebSocket(`wss://${window.location.hostname}/chat`)
const showMessage = message =&gt; {
const list = document.querySelector("#messageList")
......@@ -679,7 +679,7 @@ module.exports = (request, response) => {
&lt;h2&gt;Messages&lt;/h2&gt;
&lt;ul id="messageList"&gt;&lt;/ul&gt;
&lt;script&gt;</span><span class='language-js'>
const socket = new WebSocket("wss://localhost/chat")
const socket = new WebSocket(`wss://${window.location.hostname}/chat`)
const showMessage = message =&gt; {
const list = document.querySelector("#messageList")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment