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

Wrong peerMetadata Sent on Message receive in BroadcastChannel adapter #270

Closed
justin0mcateer opened this issue Jan 11, 2024 · 4 comments
Closed

Comments

@justin0mcateer
Copy link

https://github.com/automerge/automerge-repo/blob/main/packages/automerge-repo-network-broadcastchannel/src/index.ts#L60

The 'peer-candidate' event is emitted with the peerMetadata of the local Peer, NOT the metadata of the peer we received the message from.

This doesn't make sense and is different from the 'MessageChannel' implementation for example.

@acurrieclark
Copy link
Collaborator

Is the senderId in this context not the one received in the message? If so, it is indeed from the new peer.

@justin0mcateer
Copy link
Author

senderId is unpacked from the received message in the message handler here:
const { senderId, type } = message

The peerMetadata value is closed over from the call to 'connect' which receives the local peerMetadata from the NetworkSubsystem.

@acurrieclark
Copy link
Collaborator

My apologies, I didn’t read your issue correctly at all. You are indeed correct.

Are you in a position to put in a PR?

@acurrieclark
Copy link
Collaborator

Fixed by #287

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

2 participants