Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Msgpack Standardization #24

Open
pcfreak30 opened this issue Jan 18, 2024 · 4 comments
Open

Msgpack Standardization #24

pcfreak30 opened this issue Jan 18, 2024 · 4 comments

Comments

@pcfreak30
Copy link

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

@pcfreak30
Copy link
Author

In JSON, a web app stores its files as objects of objects, but in msgpack its a list of objects.

@pcfreak30
Copy link
Author

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.

@pcfreak30
Copy link
Author

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()));
  }

@pcfreak30
Copy link
Author

I would also recommend abstracting all these into message classes similar to https://git.lumeweb.com/LumeWeb/libs5-go/src/branch/develop/protocol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant