feat(sds): adds ephemeral messages, delivered message callback and event#2302
Merged
adklempner merged 1 commit intomasterfrom Apr 22, 2025
Merged
feat(sds): adds ephemeral messages, delivered message callback and event#2302adklempner merged 1 commit intomasterfrom
adklempner merged 1 commit intomasterfrom
Conversation
size-limit report 📦
|
5 tasks
weboko
reviewed
Mar 12, 2025
| * @param payload - The payload to send. | ||
| * @param callback - A callback function that returns a boolean indicating whether the message was sent successfully. | ||
| */ | ||
| public sendEphemeralMessage( |
Collaborator
There was a problem hiding this comment.
generally curious why you separate ephemeral from regular messages and not doing single send entry?
Member
Author
There was a problem hiding this comment.
Initially I tried that but decided that:
- the logic is different enough that it doesn't look clean in the code
- the concept is different enough that I want it to be as explicit/obvious as possible for the library consumer when an ephemeral message is being used. I don't believe it will be used often but we will see
5a3bc1b to
a7f97b7
Compare
f43d4d9 to
3ba0f16
Compare
weboko
reviewed
Mar 25, 2025
| "node": ">=20" | ||
| }, | ||
| "dependencies": { | ||
| "@libp2p/interface": "^2.7.0", |
Collaborator
There was a problem hiding this comment.
let's make it strictly 2.7.0
weboko
approved these changes
Mar 25, 2025
danisharora099
approved these changes
Mar 26, 2025
3ba0f16 to
6b4848c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem / Description
Per the spec, SDS optionally supports ephemeral messages. These are messages that do not have the same persistence/reliability requirements as regular messages, and effectively skip the buffers.
Part of the requirement is that they are delivered right away upon receipt, which revealed that there's currently no way to notify the library consumer when a message reaches the delivered state.
Solution
Add a function for sending ephemeral messages.
Add an optional callback for delivered messages that is called whenever a message reaches that state.
Use libp2p event emitter to emit an event with the message ID when a message is delivered.
The number of optional arguments in the class constructor was getting large so I replaced it with a single options struct.
Notes
Checklist