pub fn encode_message<T: Serialize>(msg: &T) -> Result<Vec<u8>>
Encode a message as 4-byte big-endian length prefix + JSON payload.