Skip to content

Commit f9467b2

Browse files
committed
Fix get client ip
1 parent 93117bd commit f9467b2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

JavaScript/2-WS/server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ const server = http.createServer(async (req, res) => {
6262

6363
const ws = new WebSocket.Server({ server });
6464

65-
ws.on('connection', (connection) => {
66-
console.log('Connected ' + connection.remoteAddress);
65+
ws.on('connection', (connection, req) => {
66+
console.log('Connected ' + req.socket.remoteAddress);
6767
connection.on('message', async (message) => {
6868
console.log('Received: ' + message);
6969
const obj = JSON.parse(message);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy