You are viewing...

MessagePack JS doesn't Fully Support Int64

Updated on April 01, 2022 at the 13th hour
Posted under:

DISCLAIMER: Expressed views on this blog are my own.

The MessagePack Protocol supports 64bit Integers, but for whatever reason msgpack for js still decided not to fully support 64 bit ints. Javascript supports 64 bit integers through arbitrary bit precision bigint, so it is insufficient to say the language does not fully support the protocol.

So fuck em, I'm forking it and adding support for my own purpose. I've no confidence that the protocol will support 128bit integers anytime soon. Not that that matters to me since UUIDs and ULIDs are serialized to uint8 arrays and then deserialized to the correct type.

I ran into trouble where a rust server correctly sent u64 to a javascript app but javascript interprets them as number type which has limited precision, so the number is incorrect by a few bits. 🙄 When msgpack javascript serialized the number, it'll serialize it back into a FLOAT. My rust server is like wtf is going on? It's not even fully compatible with the protocol.

You just read "MessagePack JS doesn't Fully Support Int64". Please share if you liked it!
You can read more recent posts here.