Mercurial
comparison mrjunejune/src/talk/index.html @ 138:1f023b8bf9c3
[Test]
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Fri, 09 Jan 2026 11:35:07 -0800 |
| parents | 095f7dc5bfce |
| children | e8f693bece90 |
comparison
equal
deleted
inserted
replaced
| 137:095f7dc5bfce | 138:1f023b8bf9c3 |
|---|---|
| 24 {{/parts/footer.html}} | 24 {{/parts/footer.html}} |
| 25 <script> | 25 <script> |
| 26 const host = window.location.hostname; | 26 const host = window.location.hostname; |
| 27 const port = '6969'; | 27 const port = '6969'; |
| 28 const url = host === "mrjunejune.com" ? `wss://${host}/echo` : `ws://${host}:${port}/echo`; | 28 const url = host === "mrjunejune.com" ? `wss://${host}/echo` : `ws://${host}:${port}/echo`; |
| 29 const ws = new WebSocket(`ws://${host}:${port}/echo`); | 29 const ws = new WebSocket(url); |
| 30 const messagesDiv = document.getElementById('messages'); | 30 const messagesDiv = document.getElementById('messages'); |
| 31 | 31 |
| 32 ws.onopen = () => { | 32 ws.onopen = () => { |
| 33 console.log('Connected!'); | 33 console.log('Connected!'); |
| 34 appendMessage('System: Connected to server'); | 34 appendMessage('System: Connected to server'); |