Skip to content

Commit d69d0b8

Browse files
committed
err
1 parent 8cb5d40 commit d69d0b8

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

client/src/Hooks/useUpdaterSocket.hook.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function useUpdaterSocket(updateData, auth) {
2424
console.log("socketAddress", socketAddress)
2525
resolve(socketAddress)
2626
})
27-
.catch((err) => console.log(err))
27+
.catch((err) => console.log("getSocketAddress err", err))
2828
})
2929
// eslint-disable-next-line react-hooks/exhaustive-deps
3030
}, [])

server/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ app.use(express.json({ extended: true }))
2525
app.get('/getSocketAddress', (req, res) => {
2626
getIp()
2727
.then((ip) => {
28-
const socketAddress = (httpsRedirect ? "wss" : "ws") + "://" + (ip || "localhost") + ":" + WS_PORT
28+
const socketAddress = ((req.protocol === 'https' || httpsRedirect) ? "wss" : "ws") + "://" + (ip || "localhost") + ":" + WS_PORT
2929
res.status(200).json({ socketAddress })
3030
})
3131
.catch(() => res.status(500))

server/socket/wss.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ function startWSS(port) {
5858
})
5959
})
6060
// обработка ошибки клиента
61-
wsClient.on("error", () => {
62-
wsClient.close()
61+
wsClient.on("error", (ws, err) => {
62+
wsClient.close(undefined, err)
6363
})
6464
})
6565
wsServer.on("close", () => console.log("WSS closed"))

0 commit comments

Comments
 (0)