syntax = "proto3"; // 整体封装的消息体 message RequestFrame { uint32 packet_id = 1; oneof body { AuthRequest auth_request = 2; RpcRequest rpc_request = 3; } } message ResponseFrame { uint32 packet_id = 1; oneof body { AuthReply auth_reply = 2; RpcReply rpc_reply = 3; } } message CastFrame { oneof body { Pub pub = 1; Command command = 2; Data data = 3; TaskEventStream event_stream = 4; } } // message定义 message AuthRequest { bytes uuid = 1; bytes username = 2; bytes salt = 3; bytes token = 4; int32 timestamp = 5; } message AuthReply { int32 code = 1; bytes payload = 2; } message Pub { bytes topic = 1; int32 qos = 2; bytes content = 3; } message Command { int32 command_type = 1; bytes command = 2; } message RpcRequest { bytes method = 1; bytes params = 2; } message RpcReply { oneof body { bytes result = 1; bytes error = 2; } } message Data { bytes route_key = 1; bytes metric = 2; } message TaskEventStream { int32 task_id = 1; bytes type = 2; bytes stream = 3; }