how to get client IP address with node grpc
See original GitHub issueEarlier I used below code to get the client IP on express js-
req.connection.remoteAddress || req.socket.remoteAddress || req.connection.socket.remoteAddress```
would like to know what is the way to get IP of client with grpc node application. I tried getPeer() which gives always ipv4:127.0.0.1:33944 even when API call is from outside.
Does something equivalent to below go code work?call.getAttributes().get(Grpc.TRANSPORT_ATTR_REMOTE_ADDR).toString();
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
how to get client IP address with node grpc - Stack Overflow
You can get the client IP and port by: const SayHello = async function (call, callback) { const IPandPort = call.
Read more >Basics tutorial | Node - gRPC
This tutorial provides a basic Node.js programmer's introduction to working with gRPC. By walking through this example you'll learn how to:.
Read more >Building a gRPC Client and Server with Node.js
Following is the list: — server() It will create the server. — bindAsync() will specify the address and port to listen to the...
Read more >How to get a client IP Address in Node.js (6 ways) - Abstract API
How to get a client IP Address in Node.js (6 ways) · 1. Retrieve User IP Address From the Request Object's Socket Property...
Read more >gRPC service in Node.js: Tutorial, Examples and Best practices
A gRPC service contains, the server, protocol buffer, and the client. The server has the procedures or subroutines or methods that perform ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have published version 1.1.4 with that change, so
getPeer
should now work.Hello @murgatroid99,
any update when
ServerUnaryCallImpl.getPeer()
will be available in grpc-js? Are the failed build jobs in #1526 caused by configuration/invokation issues or actual failing tests? The logs seems to be empty and the PR’s changes don’t appear to be too complex.