Skip to content

feat!: remove broadcastTalkReq#282

Merged
wemeetagain merged 1 commit intomasterfrom
cayman/remove-broadcast-talk-req
Jan 19, 2024
Merged

feat!: remove broadcastTalkReq#282
wemeetagain merged 1 commit intomasterfrom
cayman/remove-broadcast-talk-req

Conversation

@wemeetagain
Copy link
Copy Markdown
Member

BREAKING CHANGE:
broadcastTalkReq has been removed since it was very opinionated and can be trivially reproduced using kadValues and sendTalkReq.

function broadcastTalkReq(
  discv5: IDiscv5, payload: Buffer, protocol: string | Uint8Array
): Promise<Buffer> {
  const requests = []
  for (const enr of discv5.kadValues()) {
    requests.push(discv5.sendTalkReq(enr, payload, protocol)
  }
  // Depending on the use case
  // you might want to replace with Promise.allSettled
  // to return all responses / errors
  return Promise.race(requests)
}

BREAKING CHANGE:
`broadcastTalkReq` has been removed since it was very opinionated and
can be trivially reproduced using `kadValues` and `sendTalkReq`.

```ts
function broadcastTalkReq(
  discv5: IDiscv5, payload: Buffer, protocol: string | Uint8Array
): Promise<Buffer> {
  const requests = []
  for (const enr of discv5.kadValues()) {
    requests.push(discv5.sendTalkReq(enr, payload, protocol)
  }
  // Depending on the use case
  // you might want to replace with Promise.allSettled
  // to return all responses / errors
  return Promise.race(requests)
}
```
@wemeetagain wemeetagain requested a review from a team as a code owner January 19, 2024 20:31
@wemeetagain wemeetagain merged commit 1b70558 into master Jan 19, 2024
@wemeetagain wemeetagain deleted the cayman/remove-broadcast-talk-req branch January 19, 2024 20:33
@github-actions github-actions bot mentioned this pull request Jan 19, 2024
@github-actions github-actions bot mentioned this pull request Jan 30, 2024
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

Successfully merging this pull request may close these issues.

1 participant