Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bcfccf6

Browse files
committed
SERIALISATION.md: Add note re CBOR.
1 parent 8790817 commit bcfccf6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

SERIALISATION.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ The `protobuf` standard requires transmitter and receiver to share a schema
6161
which defines the message structure. Message length may change at runtime, but
6262
structure may not.
6363

64+
There has been some discussion of supporting [CBOR](https://cbor.io/). There is a
65+
MicroPython library [here](https://github.com/onetonfoot/micropython-cbor). This
66+
is a binary format with a focus on minimising message length. I have not yet had
67+
time to study this.
68+
6469
## 1.1 Transmission over unreliable links
6570

6671
Consider a system where a transmitter periodically sends messages to a receiver
@@ -77,7 +82,7 @@ signals the transmitter to request retransmission.
7782

7883
## 1.2 Concurrency
7984

80-
In `uasyncio` systems the transmitter presents no problem. A message is created
85+
In `asyncio` systems the transmitter presents no problem. A message is created
8186
using synchronous code, then transmitted using asynchronous code typically with
8287
a `StreamWriter`. In the case of ASCII protocols a delimiter - usually `b"\n"`
8388
is appended.
@@ -99,7 +104,7 @@ identical methods so this doc may be used for both.
99104

100105
The advantage of `ujson` is that JSON strings can be accepted by CPython and by
101106
other languages. The drawback is that only a subset of Python object types can
102-
be converted to legal JSON strings; this is a limitation of the
107+
be converted to legal JSON strings; this is a limitation of the
103108
[JSON specification](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
104109

105110
The advantage of `pickle` is that it will accept any Python object except for
@@ -256,7 +261,7 @@ string can be done with:
256261
```python
257262
import umsgpack
258263
obj = [1.23, 2.56, 89000]
259-
msg = umsgpack.dumps(obj) # msg is a bytes object
264+
msg = umsgpack.dumps(obj) # msg is a bytes object
260265
```
261266
Retrieval of the object is as follows:
262267
```python
@@ -458,7 +463,7 @@ emitting field headers as seen in regular repeated fields.
458463
>>> packed=minipb.Wire('#z')
459464
>>> len(packed.encode(range(10000)))
460465
21748
461-
>>>
466+
>>>
462467
```
463468

464469
The author of `minipb` [does not recommend](https://github.com/dogtopus/minipb/issues/6)

0 commit comments

Comments
 (0)