We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ba1a467 commit 9b2888bCopy full SHA for 9b2888b
apis/websocket/src/index.ts
@@ -56,12 +56,13 @@ const wss = new WebSocketServer({
56
57
wss.on('connection', async (socket, request) => {
58
try {
59
- if (!request.socket.remoteAddress) {
+ const addrInfo = request.socket.address()
60
+ if (!('address' in addrInfo)) {
61
socket.close()
- return logger.warn('Connection failed because client is missing remote address')
62
+ return logger.warn('Connection failed because client is missing remote address. addrInfo =', addrInfo)
63
}
64
- const id = `${request.socket.remoteAddress}:${request.socket.remotePort}`
65
+ const id = `${addrInfo.address}:${addrInfo.port}`
66
67
if (clientIds.has(id)) {
68
logger.warn(`Client ${id} already connected, disconnecting old session`)
0 commit comments