简体   繁体   中英

Confusion over JavaScript implementations of MessagePack

The official MessagePack page links to the page:

but its last update is three years ago. On the other hand, there are other implementations of MessagePack in JavaScript such as:

What are the differences among them? Which one is the most authentic one? Which one should I use?

Technically, https://github.com/msgpack/msgpack-javascript is the official MessagePack implementation of msgpack for JavaScript. A developer who goes by the handle "uupaa" wrote the implementation of it. He hasn't touched the code in some time.

I have an outstanding pull request that fixes a map handling issue that I hope he implements at some point. Barring that, though, I have had no problems using this library.

The reason I decided not to go with creationix's solution is because it adds JS-specific extensions to the msgpack specifiction. The extensions did not work well with other msgpack implementations.

Perhaps you should try https://github.com/creationix/msgpack-js ; it is the only one updated in the last few months. I'm also looking into client-side javascript libraries for MessagePack and I'm unsure of which one to use as well; they all look like suitable implementations so I'll have to just test them each out.

Coming from the msgpack.org website I was only aware of a single JavaScript implementation, msgpack-lite by kawanet. It doesn't support the DateTime extension, though, so I went ahead and made my own library. It's very much smaller and almost as fast. It also supports exactly the official MessagePack specification, nothing more or less. You might give it a try, if you like: https://github.com/ygoe/msgpack.js I'm using it myself in combination with a C# library on the server side for WebSocket communication.

(Disclaimer: I am the author of the linked library.)

I have restarted to maintain https://github.com/msgpack/msgpack-javascript , released as @msgpack/msgpack , with completely new codebase in TypeScript, optimized for browsers or pure ECMA-262 JavaScript engines, employing new ES features like whatwg-stream, AsyncIterator, and so on.

I wish it clear the confusions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM