问题描述
有没有办法在 JavaScript 中做协议缓冲区?
Is there a way to do protocol buffers in JavaScript?
为什么要使用 .js?
Why for .js?
如果您暂时考虑一下科学要求,就会出现您可能想要向客户端发送大量数据的情况.使用 CRUD 风格,你使用什么并不重要.对于科学的东西,它确实很重要(至少我认为它很重要).
If you think about sciencey requirements for a moment, situations pop up where you might want to send a large block of data to the client. With CRUD-style it doesn't really matter so much what you use. With sciencey stuff it does matter (at least I think it does).
权衡:
protobuffs 很好地平衡了紧凑性、序列化和反序列化速度.
protobuffs balances compactness, serialize and deserialize speeds well.
基于文本的协议 (xml/json) 具有更大的消息大小...但我想知道使用 javascript 哪个更有效.
text based protocols (xml / json) have a larger message size... but with javascript I wonder which is more effective.
参考:
code.google.com/p/protobuf-plugin-closure
code.google.com/p/protobuf-plugin-closure
Google Protocol Buffers 或类似的东西.net/javascript
https://github.com/sirikata/protojs
http://www.vitaliykulikov.com/2011/02/gwt-friendly-protocol-buffers.html
http://benhakala.blogspot.com/2010/05/converting-google-protocol-buffers-to.html(暗示可能使用 protobufs 的谷歌地图)
http://benhakala.blogspot.com/2010/05/converting-google-protocol-buffers-to.html (alludes to google maps possibly using protobufs)
社区提供的其他参考资料(有关更多背景信息,请参见下文):
Additional references provided by community (see below for more context):
http://blog.ltgt.net/exploring-using-protobuf-in-the-browser/
http://blog.ltgt.net/使用-protobuf-client-side-with-gwt
http://code.google.com/p/protobuf-gwt/
推荐答案
我一直在寻找 javascript 的 protobuf.这里有一个项目:https://github.com/dcodeIO/ProtoBuf.js
I have been looking for protobuf for javascript. There is a project here:https://github.com/dcodeIO/ProtoBuf.js
这篇关于JavaScript 的协议缓冲区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!