Open pcfreak30 opened 10 months ago
In JSON, a web app stores its files as objects of objects, but in msgpack its a list of objects.
A spec should state all file names/keys in a web app or directory should be sorted from A to Z.
Many hash map quirks between Dart and other languages need to be accounted for.
Example design bug:
final connectionUrisCount = u.unpackInt()!;
peer.connectionUris.clear();
for (int i = 0; i < connectionUrisCount; i++) {
peer.connectionUris.add(Uri.parse(u.unpackString()!));
}
u.unpackInt
and arraylen
arent the same. Need to stop creating custom array or map structures
Another example:
async sendPublicPeersToPeer(peer: Peer, peersToSend: Peer[]): Promise<void> {
const p = new Packer();
p.packInt(protocolMethodAnnouncePeers);
p.packInt(peersToSend.length);
for (const pts of peersToSend) {
p.packBinary(Buffer.from(pts.id.bytes));
p.packBool(pts.isConnected);
p.packInt(pts.connectionUris.length);
for (const uri of pts.connectionUris) {
p.packString(uri.toString());
}
}
peer.sendMessage(await this.signMessageSimple(p.takeBytes()));
}
I would also recommend abstracting all these into message classes similar to https://git.lumeweb.com/LumeWeb/libs5-go/src/branch/develop/protocol.
A lot of the current metadata formats have some awkward formatting that need to be resolved.
This should serve as a tracking issue for them all