Fern
Fern

Reputation: 103

What is the best way to implement Protobuf3 with multiple types of packets?

So I am new to protobuf3 and was wondering what would be the best way to implement my old packet system into protobuf3 for flutter/netty communication. Is there any way I can make receive/send multiple packets without having to register a decoder for each packet in netty? If so, how?

Upvotes: 0

Views: 76

Answers (1)

Fern
Fern

Reputation: 103

Well I just decided to make a list of packets that should be decoded and then make a decoder with a list of decoders that extend the protobuf decoder, and make it so it loops through all the decoders and check if it was parsed correctly and return the object if it was. The source is here (MultiplePacketDecoder should be added to the pipeline with the list of SinglePacketDecoder added in it's constructor)

Upvotes: 0

Related Questions