5 ms·
For someone saw CBOR, CBOR is kinda binary version of JSON, like MsgPack. CBOR is already mature as it is used in web browsers internally by a web standard [1]
by kbumsik 7y ago
For someone saw CBOR, CBOR is kinda binary version of JSON, like MsgPack. CBOR is already mature as it is used in web browsers internally by a web standard [1] (and yes, Signed HTTP is in a controversy though...)
Because it is pretty much optimized for machine readability and lightness, one of usage is microcontrollers for IoT, with CBOR + CoAP(kinda HTTP for IoT), although I wouldn't say it is common yet, since CoAP needs IPv6.
[1]: https://wicg.github.io/webpackage/draft-yasskin-http-origin-signed-responses.html#cbor-representation https://wicg.github.io/webpackage/draft-yasskin-http-origin-...
- unmole 7y agoYou would probably reach for CoAP when your nodes are speaking 6LoWPAN but, there's nothing about CoAP that requires IPv6.
- magicalhippo 7y agoI recently wanted to use something JSON-RPC'ish for communication between host PC and my microcontroller. I looked into CBOR/MessagePack as well as UBJSON. I didn't find a CBOR/MessagePack nor UBJSON implementation that was microcontroller-friendly and easy to use. In the end I ended up just using plain JSON. Easy to debug as you can easily see what's on the wire, easy to implement, relatively small code size.
- kbumsik 7y agoMost CBOR implementations for MCUs tend to be a part of RTOSs, integrated and optimized for their own memory allocation libraries. But many of them are based on Intel's TinyCBOR: https://github.com/intel/tinycbor https://github.com/intel/tinycbor
- Rafert 7y agoI'd point towards WebAuthn[0] as a reason why browsers implement CBOR, since that's much more widely supported. [0]: https://www.w3.org/TR/webauthn-1/#dependencies https://www.w3.org/TR/webauthn-1/#dependencies