How to send grpc meta-data from client side

bharat nc :

I'm using grpc.Dial(server) in golang to setup a grpc connection to my server.

How do I send meta-data or custom headers through this Dial connection (from client side)?

SwiftD :

I presume grpc is your client connection object.

You create meta data using the metadata subpackage from a map[string]string (some other methods provided), you then pass it via context e.g

md := metadata.New(map[string]string{"key1": "val1", "key2": "val2"})
ctx := metadata.NewOutgoingContext(context.Background(), md)

Because you pass meta data via context you will need to use client.DialContext() rather than Dial I think https://godoc.org/google.golang.org/grpc#DialContext

See here for some examples - https://github.com/grpc/grpc-go/blob/master/Documentation/grpc-metadata.md

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to read Meta data in gRPC using Java at client side

How to send client side data to server side

How do I send form data from the client side to the server

How to send data from server-side (Express.js) to client-side (React.js)?

Send gridview data from client side to server side at once

How to get Open Graph meta from URL input on the client side

How to send Spring Boot admin client meta data to admin server

How to send back the data got from response.on('end') to the client-side

boost::asio how to send string data from client and store it at server side for processing

How can I receive data on client side before calling .end() on the server side for a gRPC stream

send data from client side javascript to node js

How to get data from mongodb on client side?

How can I send information from NodeJS server to client side?

How to render image on react client side send from express js

How data is sent from client to (multi-service) server in gRPC

gRPC context on the client side

How to send data from client to raspberry pi?

How to send data from client to server in Meteor?

How to read and send data to client from server?

How to send JSON from server-side (nodejs) to client-side with Ajax?

Pass data from client side to server side

Send button from c# to client side

Ways to wait if server is not available in gRPC from client side

get the binary data transferred from grpc client

How to access data within an array of objects sent from client side?

How to transmit data to client-side js file from the server?

How to append data to the repeater control from client side

How to get data from client side with odoo rest api server?

how to fetch POST request body data from the client side?