Protocol buffers for JavaScript?

Is there a way to make protocol buffers in JavaScript?

Why for .js?

If you think about the requirements for science for a while, situations arise when you can send a large block of data to a client. With a CRUD style, it doesn't really matter what you use. With scientific material, it matters (at least, I think it is).

compromise:

  • protobuffs provides compactness, serialization and deserialization of speeds.

  • text protocols (xml / json) have a larger message size ... but with javascript, I wonder what is more efficient.

link:

Additional links provided by the community (see below for more details):

+21
javascript gwt protocol-buffers
Aug 16 2018-11-11T00:
source share
3 answers

I was looking for protobuf for javascript. There is a project here: https://github.com/dcodeIO/ProtoBuf.js

+7
Apr 14 '12 at 19:39
source share

Google actively uses protocol buffers in JS (GMail, etc.) through its Closure Library, generating JS code with a modified protoc (unfortunately not open source) (it will probably have to be ported to protoc before open source code).

Apache Wave (a client Webapp server with GWT) also uses protocol buffers to communicate with the server, generating Java code, reflecting the Java classes created using protoc (this is PST, aka protobuf-stringtemplate, subproject).
Wave used protostuff earlier (and I don’t know why they switched to their own solution, I suspect that PST comes from what the original Google Wave used, and protostuff was only an intermediate step during the transition to open-source).

As a side note, I began to study the use of protocol buffers on the browser side some time ago: http://blog.ltgt.net/exploring-using-protobuf-in-the-browser/ and http://blog.ltgt.net/ using-protobuf-client-side-with-gwt with some almost working code in http://code.google.com/p/protobuf-gwt/ that you might want to resurrect.

Finally, work is underway to ensure that GWT RequestFactory proxies are compatible with server-side Java classes generated using protoc (and you could use the protoc extension or a similar approach to Wave PST to create RequestFactory proxy requests). This should be possible if you use builders entirely on the server side (which is not quite the way the Java protocol API was developed).

+12
Aug 18 '11 at 2:55 a.m.
source share

Historically, javascript has been working with binary pain, which probably partially explains the relative lack of tools - but with arrays typed by javascript can now be much easier. I agree that if you need to get the same amount of data (through some format), using less bandwidth is a plus, but before you start, you will need to verify that the bandwidth / processing was actual bottleneck (and if bandwidth: you tried gzip / deflate first).

I am a fan of protobuf - and I would love to see a stronger browser technique, but json is so ubiquitous that you need a good reason to challenge the status quo. Also; think of jsonp.

+8
Aug 16 '11 at 6:15
source share



All Articles