我正在使用 Google protobuffer 解码一些缓冲区。我正在使用出色的 @decodeIO ProtoBuf.js模块。
当我尝试解码此缓冲区时:
<Buffer 0a 0b 47 57 5f 2d 31 38 5f 39 39 32 39>
从这个消息:
message PaymentResponseElement {
optional int64 pnPaymentId = 1;
optional string messageCode = 2; //won't use pb enum here
optional int64 balanceAfterTransaction = 3;
optional int32 version = 4;
}
我收到此错误:
Error: Illegal wire type for field Message.Field .core.comm.PaymentResponseElement.messageCode: 2 (0 expected)
at ProtoBuf.Reflect.Field.decode (/home/joojo/node_modules/protobufjs/ProtoBuf.js:2095:27)
at ProtoBuf.Reflect.Message.decode (/home/joojo/node_modules/protobufjs/ProtoBuf.js:1748:51)
at ProtoBuf.Reflect.Field.decode (/home/joojo/node_modules/protobufjs/ProtoBuf.js:2196:46)
at ProtoBuf.Reflect.Message.decode (/home/joojo/node_modules/protobufjs/ProtoBuf.js:1746:51)
at Function.Message.decode (/home/joojo/node_modules/protobufjs/ProtoBuf.js:1630:41)
at decode (/home/joojo/public_html/api/control/protoBuffer.js:94:52)
at Object.module.exports.decode (/home/joojo/public_html/cageapi/control/protoBuffer.js:110:10)
at decode (/home/joojo/public_html/api/control/messageStructurer.js:82:33)
at Object.module.exports.decode (/home/joojo/public_html/api/control/messageStructurer.js:94:10
at CleartextStream.month (/home/joojo/public_html/api/connectionHandler.js:83:32)
不知道怎么回事,已经好几次了。如何解决?