Skip to content

Storage for different event kinds #224

@SubatomicPlanets

Description

@SubatomicPlanets

Received messages should not always be stored and retrieved like they are now. For example, in my app I use get_messages() with pagination to get the last 100 messages. Right now this works because my app can only send chat messages (like texts or images). But now I want to add read receipts, reactions, online indicators, and more. Some of these new features should obviously not be stored and retrieved in the same way as chat messages (I don't want last_message to return a read receipt. I also don't want the last 100 messages to be filled with online indicators).

As discussed in #193, it would be nice to store/retrieve received messages differently depending on the event kind. I'm not sure if the storing or the retrieving should be changed (one could just add some sort of kind filter when using get_messages() and other functions). In any case, this section in NIP-01 could be helpful. Maybe MDK should just follow this when storing events so that events can be regular, replaceable, ephemeral, or addressable?

I'm not sure how this should be implemented, but currently the only way I can add ephemeral events is to drop the pagination when retrieving messages and then filter them by kind, which is obviously not ideal...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions