mixed messages in a stream

59 views
Skip to first unread message

Brad Taylor

unread,
Apr 15, 2025, 4:03:15 AM4/15/25
to grpc.io
Is it allowed to send and receive mixed messages in a stream?  Treat iis I have a proto file with two message, a header message and a content message.  I want my server to receive one header and a random amount of content messages.  It looks like the rpc directive only allows a single message definition.  I considered using repeated field, but that looks like it only accepts a constant value at definition time, not a computed one at run time. 

Kannan Jayaprakasam

unread,
Apr 23, 2025, 6:43:49 AM4/23/25
to grpc.io
You can define a oneof message that is one of header message or content message, and define your RPC as a stream of this oneof message type.
Reply all
Reply to author
Forward
0 new messages