I am getting the following error when i try to decode bytearray using protobuf.js decode
error: Illegal group end indicator for Message .SampleMessage: 1749 (not a group) at Error (native) at ProtoBuf.Reflect.MessagePrototype.decode (http://127.0.0.1:53259/libs/protobuf/dist/ProtoBuf.js:3168:31) at Function.Message.decode (http://127.0.0.1:53259/libs/protobuf/dist/ProtoBuf.js:2896:37)
code snippet: sample.proto - file
message SampleMessage {
required string text = 1;
}
Java code For encode:
SampleMessage msg = SampleProto.SampleMessage.newBuilder().setText("test data ").build();
ObjectOutputStream out = new ObjectOutputStream(response.getOutputStream());
out.writeObject(msg);
out.flush();
Decode using javascript :
var ProtoBuf = dcodeIO.ProtoBuf;
var SampleMessage = ProtoBuf.loadProtoFile("com/cm/model/sample.proto").build("SampleMessage");
var msg = SampleMessage.decode(response.data);

I strongly suspect that this is the problem:
ObjectOutputStream out = new ObjectOutputStream(response.getOutputStream());
out.writeObject(msg);
Why are you using ObjectOutputStream? That's for Java's native binary serialization protocol, which isn't the same as Protocol Buffers. Even though protobuf has some support for Java's serialization (so that if you're already using the built-in serialization, you can still serialize protobuf messages) you shouldn't be using that unless you're using Java serialization at both sides.
You should be using
SampleMessage msg = SampleProto.SampleMessage.newBuilder().setText("test data ").build();
msg.writeTo(response.getOutputStream());
See more on this question at Stackoverflow