const object =[MsgId.SelectRoles,[id]//虽然是整数,但是也强制转成FLOAT64发出去了/* */];const encoded: Uint8Array = msgpack.encode(object);if (this.websocket != undefined) {console.log('send',encoded)this.websocket.send(encoded)}
struct MsgSelectRoles
{MsgSelectRoles() {}MsgId id = MsgId::Say;// std::vector<uint64_t> ids;这一句异常,TypeScript不支持整型std::vector<double> ids;//TypeScript只有FLOAT64,没有POSITIVE_INTEGER和NEGATIVE_INTEGERMSGPACK_DEFINE(id,ids);
};const auto msg = obj.as<MsgSelectRoles>();
反序列化为对象异常,因为TypeScript不能用整型,只能用浮点型。