Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Apache Avro in javascript [closed]

Is there a means to use Avro on the client side through javascript and REST or RPC or websocket?

If so, with with js library?

like image 909
Xavier Méhaut Avatar asked Aug 13 '15 14:08

Xavier Méhaut


People also ask

Is Avro better than JSON?

We think Avro is the best choice for a number of reasons: It has a direct mapping to and from JSON. It has a very compact format. The bulk of JSON, repeating every field name with every single record, is what makes JSON inefficient for high-volume usage.

When should I use Apache Avro?

Apache Avro is especially useful while dealing with big data. It offers data serialization in binary as well as JSON format which can be used as per the use case. The Avro serialization process is faster, and it's space efficient as well.

Is Avro open source?

Avro is an open source project that provides data serialization and data exchange services for Apache Hadoop.


1 Answers

avsc a pure JavaScript implementation of the Avro specification and it might be the solution you are looking for.

avsc is compatible with all versions of node.js since 0.11 and major browsers via browserify (see the full compatibility table here). For convenience, you can also find compiled distributions with the releases (but please host your own copy).

I did a small lab and shared my experimental coding with avsc in a github repo: avro-rest-js, in this demo project there are examples of both client-side and server-side-rest-API in javascript exchanging avro buffers in request/response.

An example of use of avsc for RPC websocket look at https://github.com/mtth/verdon a sample Avro remote logging service running behind a WebSocket server and a corresponding client.

like image 198
Franco Rondini Avatar answered Nov 01 '22 09:11

Franco Rondini