oxen-io / oxen-mq

Communications layer used for both the Oxen storage server and oxend
https://oxen.io
BSD 3-Clause "New" or "Revised" License
19 stars 35 forks source link

feature request: Connection ID groups #65

Open majestrate opened 2 years ago

majestrate commented 2 years ago

oxend rpc code, pysogs and many other code bases would greatly benefit from adding / removing connection ids into a group and being able to send to the group and everyone in the group gets that message sent to them.

Something akin to:

struct BuddyGroup
{
    std::unordered_set<ConnectionID> _buddies;

    void add(ConnectionID);
    void remove(ConnectionID);

    template<typename Args>
    void send(Args && ...) const; // blah blah blah send to all the buddies
};
jagerman commented 2 years ago

I think it would be simpler for the API to just be able to pass an unordered_set of ConnectionIDs as the first argument to omq.send(...) -- no need to store an (invalidatable) reference to the OxenMQ, and no need to wrap the unordered_set capabilities.

majestrate commented 2 years ago

true.