feat: display the real IP address of the user (#16)
This commit is contained in:
parent
cec313e379
commit
2e05f706c6
|
|
@ -341,13 +341,17 @@ const serialize = (
|
||||||
): SerializedSocket => {
|
): SerializedSocket => {
|
||||||
const clientId = socket.data?._admin?.clientId;
|
const clientId = socket.data?._admin?.clientId;
|
||||||
const transport = socket.data?._admin?.transport;
|
const transport = socket.data?._admin?.transport;
|
||||||
|
const address =
|
||||||
|
socket.handshake.headers["cf-connecting-ip"] ||
|
||||||
|
socket.handshake.headers["x-forwarded-for"] ||
|
||||||
|
socket.handshake.address;
|
||||||
return {
|
return {
|
||||||
id: socket.id,
|
id: socket.id,
|
||||||
clientId,
|
clientId,
|
||||||
transport,
|
transport,
|
||||||
nsp,
|
nsp,
|
||||||
handshake: {
|
handshake: {
|
||||||
address: socket.handshake.address,
|
address,
|
||||||
headers: socket.handshake.headers,
|
headers: socket.handshake.headers,
|
||||||
query: socket.handshake.query,
|
query: socket.handshake.query,
|
||||||
issued: socket.handshake.issued,
|
issued: socket.handshake.issued,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue