I have a system that relies on Netty to exchange relatively short Gson strings: typically under couple of hundred bytes, sometimes a few KBs. Do I need to worry about losing packets and therefore implement Decoder into my server/client, or would it be (mostly) okay?
Share
This depends on how your client is connecting to your server.
For instance, if you are using TCP then you do not have to directly worry about packet loss in your code since the protocol itself is responsible for automatically re-transmitting any lost packets (as well as ensuring the order of the packets that arrive). However, if you are using UDP then packet loss is possible and you will have to deal with detecting and re-transmitting lost packets (as well as ordering concerns, etc).
Also, depending on how you are decoding your message, you may need to consider that a single message may be broken up into multiple frames that are sent as separate packets. To manage this, you may need to implement something like a FrameDecoder.