websocket path set to /ws

This commit is contained in:
Altair-sh 2025-09-19 07:22:09 +05:00
parent 1e47627c27
commit bc62e50e75
2 changed files with 3 additions and 1 deletions

View File

@ -442,7 +442,7 @@ class Room {
const secureProtocol = window.location.protocol === 'https:' const secureProtocol = window.location.protocol === 'https:'
const protocol = secureProtocol ? 'wss' : 'ws' const protocol = secureProtocol ? 'wss' : 'ws'
const webSocketUrl = `${protocol}://${location.host}` const webSocketUrl = `${protocol}://${location.host}/ws`
console.log('connecting to websocket', webSocketUrl) console.log('connecting to websocket', webSocketUrl)
this.webSocket = new WebSocket(webSocketUrl) this.webSocket = new WebSocket(webSocketUrl)
this.webSocket.onerror = () => showPopup('websocket-connect-failed') this.webSocket.onerror = () => showPopup('websocket-connect-failed')

View File

@ -17,6 +17,7 @@ function main(): void {
const webServer = http.createServer((req, res) => { const webServer = http.createServer((req, res) => {
serveHandler(req, res, { serveHandler(req, res, {
public: 'public', public: 'public',
unlisted: ['ws'],
}) })
}) })
@ -30,6 +31,7 @@ function main(): void {
const websocketServer = new websocket.Server({ const websocketServer = new websocket.Server({
server: webServer, server: webServer,
path: '/ws',
}) })
const broadcastServer = new Server() const broadcastServer = new Server()