Skip to content

Commit fd29744

Browse files
author
ionut.stan
committed
Added IncomingRequest.remoteAddress property.
1 parent c3f2fe4 commit fd29744

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

npm-debug.log.1656483000

Whitespace-only changes.

src/BidirectionalWebsocketRouter.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ class BidirectionalWebsocketRouter extends EventEmitter
261261
{
262262
// upgradeReq is a http.IncomingMessage
263263
incomingRequest.headers = webSocket.upgradeReq.headers;
264+
265+
incomingRequest.remoteAddress = webSocket.upgradeReq.socket.remoteAddress;
264266
}
265267

266268

src/IncomingRequest.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class IncomingRequest
2626
this._classClient = null;
2727

2828
this._objHeaders = {};
29+
this._strRemoteAddress = "";
2930

3031
//this._webSocket
3132
//this._httpRequest
@@ -260,6 +261,24 @@ class IncomingRequest
260261
}
261262

262263

264+
/**
265+
* @returns {string}
266+
*/
267+
get remoteAddress()
268+
{
269+
return this._strRemoteAddress;
270+
}
271+
272+
273+
/**
274+
* @param {string} strRemoteAddress
275+
*/
276+
set remoteAddress(strRemoteAddress)
277+
{
278+
this._strRemoteAddress = strRemoteAddress;
279+
}
280+
281+
263282
/**
264283
* @returns {Object}
265284
*/

src/Server.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ class Server extends EventEmitter
241241
}
242242

243243
incomingRequest.headers = httpRequest.headers;
244+
incomingRequest.remoteAddress = httpRequest.socket.remoteAddress;
244245

245246
const strPath = JSONRPC.EndpointBase.normalizePath(httpRequest.url);
246247

0 commit comments

Comments
 (0)