--- YJS/ydb binary protocol helpers --- ydb is a relay: it forwards binary messages between clients in the same room. It does NOT respond to SyncStep1 itself — only other connected clients do. Message format: [messageType(uvarint), sub-type-specific data...] For messageSync(0): [0, syncSubType(uvari
(buf *bytes.Buffer, n uint64)
| 47 | // For messageSync(0): [0, syncSubType(uvarint), payload(uvarint-length-prefixed)] |
| 48 | |
| 49 | func yjsWriteUvarint(buf *bytes.Buffer, n uint64) { |
| 50 | bs := make([]byte, binary.MaxVarintLen64) |
| 51 | l := binary.PutUvarint(bs, n) |
| 52 | buf.Write(bs[:l]) |
| 53 | } |
| 54 | |
| 55 | func yjsWritePayload(buf *bytes.Buffer, data []byte) { |
| 56 | yjsWriteUvarint(buf, uint64(len(data))) |
no test coverage detected