Complex communication needs two things
- a protocol so each side knows what kind of data it should expect next, e.g. command, result, notification, etc
- a format for serializing/deserializing data into/from a byte stream

Each one can be handcrafted, e.g. using QDataStream and there are also solutions that combined them or some aspects of them, e.g. https://developers.google.com/protocol-buffers/ or https://google.github.io/flatbuffers/

Cheers,
_