Hi have a proto file as follows:
enum Type
{
A = 0;
B = 1;
C = 2;
}
message Message
{
User to = 1;
User from = 2;
Type type = 3;
}
I use protoc compiler to convert it to javascript utility classes. Using this generated javascript file I set up Message object in my application as follows:
const message = new Main.Message()
message.setTo(this.user1) // saved user
message.setFrom(this.user3) // saved user
message.setType(0) // trying to set type to A
const buffer = message.serializeBinary()
socket.send(buffer)
The issue I am facing is in message object both to and from fields get updated properly, but type remains null! I am unable to figure out a solution for this.
Is this because in Message proto, expected type is as Enum? But it javascript it is not possible. How to set expected enum values while creating protobuf for dispatch?
Note:
I've noticed that, this issue happens only when I try to set
zerovalue to Enum type!