-
Notifications
You must be signed in to change notification settings - Fork 16
Conversation
const msgbuf = pb.Message.toBinary({message: buf.subarray()}); | ||
const sendbuf = lp.encode.single(msgbuf) | ||
log.trace(`[stream:${this.id}][${this.stat.direction}] sending message: length: ${res.length} ${res}, encoded through pb as ${msgbuf}`); | ||
this.channel.send(sendbuf.subarray()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More of a question, but why do you have to call subarray
all the time? Is it to switch type somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Uint8ArrayList
can have a single message spread across multiple different Uint8Array
instances. Calling subarray
makes them readable as a single Uint8Array
which is much easier to work with.
@ckousik does this resolve the compatibility issues you were seeing with libp2p/rust-libp2p#2622? |
yes |
🎉 This PR is included in version 1.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Add length prefix to protobuf messages.