title: How to decode protobuf base64 string to js object
body: <p>I'm try to decode protobuf message from server side (base64 string) to javascript object. Use for decode <a href="https://github.com/dcodeIO/protobuf.js" rel="nofollow">protobuf.js</a>.</p>
  
  <p>As doc suggest : </p>
  
  <pre><code>var builder = ProtoBuf.newBuilder({ convertFieldsToCamelCase: true });
  var YourMessage = builder.build("YourMessage");
  var buffer = ...; // E.g. a buffer received on a WebSocket
  var myMessage = YourMessage.decode(buffer);
  ...
  var b64str = ...; // E.g. a string fetched via AJAX
  var myMessage = YourMessage.decode64(b64str);
  </code></pre>
  
  <p>This is how I try to do it (data - base64 string) :</p>
  
  <pre><code>var proto = dcodeIO.ProtoBuf;
  var buffer = dcodeIO.ByteBuffer;
  var b = buffer.wrap(data,"binary");
  var builder = proto.newBuilder({ convertFieldsToCamelCase: true });
  builder.define("Events");
  var message = builder.build("Events");
  var result = message.decode(b); //also try to decode base64 string - message.decode64(data);
  </code></pre>
  
  <p>I get error </p>
  
  <blockquote>
    <p>decode/decode64 undefined</p>
  </blockquote>