Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

106
Visualizações
handling Any within a protocol buffer with javascript

I'm trying to handle some generic Message values within a wrapping protocol buffer (with nodejs):

message MessageWrapper {
    string id = 1;
    google.protobuf.Any wrapped_message = 2;
    ....
}

as part of this, I have to pack() the Any:

const wrapper = new MessageWrapper();
const wrappedMessage = new Any();
wrappedMessage.pack(msg.serializeBinary(), msgType);

The heart of the problem is the msgType. If I was using java, I could get the msg.getDescriptorForType(), but javascript doesn't seem to support that.. level of self description. Outside of manually supplying the string type url, how does one get it?

Addendum: To be honest I'm not sure what the msgType of pack() is used for. It seems I can put any string value in there and packing and unpacking seem to work fine. What's it for?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda