Protobuf Collections

Learn about the workings of collections in Protobuf and the use of the repeated keyword.

Any programming language can bundle items of the same data type together into one coherent collection of a variable length. The same is true for messaging format. We can use collections in JSON. We can have collections of repeated elements inside an XML or any other popular messaging format.

Protobuf is not an exception. The protocol supports collections via the use of the repeated keyword. All we have to do is place this keyword before a field definition inside a message structure. This is what we'll look at next.

Applying the repeated keyword in Protobuf

We'll use the code widget below to modify the gRPC client and server applications that we built previously:

Get hands-on with 1200+ tech skills courses.