[]关于protobuf反序化的问题,求大神解答~~~

官方的protobuf例字,读取proto文件赋值,encode进行序化,decode反序化,但是这个时候,我除了发送proto文件里的,另外还要发送其他的 比如这个message:
message user_login_pack 
{
required string uid = 1;
required string token = 2;
}
js的代码:
var proto = this.ProtoBuf.loadProtoFile("user_login.proto");
var Build = proto.build("user_login_pack");
var login = new Build();
login.uid = '100001';
login.token = "xxxxx";
var buffer = login.toArrayBuffer()
this.socket.send(buffer);
 
这样直接可以Build.decode(login)反序化。
 
那么我在发送login.toArrayBuffer()的同时,还要发送另外的,比如:
 
this.byte.writeInt32(123);
this.byte.writeInt32(1234);
this.byte.writeArrayBuffer(buffer);
this.socket.send(this.byte.buffer);
那么现在的数据要怎么反序化呢
已邀请:

Monica - 知识达人

赞同来自:

protobuf用的是github上的,你直接到github上看下文档吧

要回复问题请先

商务合作
商务合作