-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get UserAgent on server side #1100
Comments
It is added to the metadata which you can access from the context.
https://github.com/grpc/grpc-go/blob/8b2e129857480cb0f07ef7d9d10b8b252c7ac984/transport/http_util.go#L208
…On Thu, Mar 2, 2017 at 10:58 AM, Sam Nguyen ***@***.***> wrote:
How would I access the UserAgent of the client stream in my GRPC server? I
can't seem to find any examples or interfaces that would allow this.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1100>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATtnRzde2G9VrhB_p5zjy5k-TceIsuJKks5rhxFmgaJpZM4MRY1p>
.
|
Usually, the user-agent can be included on the client side and extracted from the server side. You can add a user-agent using the WithUserAgent("user-agent") function that grpc provides when making the dial connection.
On the server side, you can extract it out from the incoming context meta-data:
where mD consists of key,val pairs and the way you would want to get hold of the user-agent is using its's key.
|
How would I access the UserAgent of the client stream in my GRPC server? I can't seem to find any examples or interfaces that would allow this.
The text was updated successfully, but these errors were encountered: