Parcelable data from client to server can use ParcelableUtils.metadataKey to build grpc [Metadata headers].
but, how to send Parcelable data from server to client??
[Metadata headers] is only client to server?
Parcelable data from client to server can use ParcelableUtils.metadataKey to build grpc [Metadata headers].
but, how to send Parcelable data from server to client??
[Metadata headers] is only client to server?
Copyright © 2021 Jogjafile Inc.
Metadata is available just before the request (i.e., headers), or just before or after the response (i.e., headers or trailers).
The basic approach is the same in all the cases: use an interceptor. But how you use an interceptor and communicate with the interceptor varies between client and server.
The header example shows a server interceptor adding metadata to response headers:
That approach is the same independent of the type of Metadata (text, binary, or Parcelable). The only difference for the different types of Metadata is the construction of the
Metadata.Key.But with Binder, you are probably wanting the gRPC service to compute the Parcelable to respond with. For that, you need to pass a mutable API for the service to update.