Skip to content

Subscribe only to specific publishers #193

@thedevbirb

Description

@thedevbirb

From sub/socket.rs:

    /// Subscribes to the given topic. This will subscribe to all connected publishers.
    /// If the topic does not exist on a publisher, this will not return any data.
    /// Any publishers that are connected after this call will also be subscribed to.
    pub async fn subscribe(&mut self, topic: impl Into<String>) -> Result<(), SubError> {

So if a consumer of this library wants to have hybrid setups where it only wants to subscribe to a subset of publishers, it needs to create multiple sub-sockets and potentially merging the streams into one.

As such, we may offer a more specific version of this function:

    /// Subscribes to the given topic. This will subscribe only to the provided publisher.
    /// If the topic does not exist on a publisher, this will not return any data.
    pub async fn subscribe_to_publishers(&mut self, topic: impl Into<String>, publishers: Vec<SocketAddr>) -> Result<(), SubError> {

I want to create a discussion first, I'm still on the fence whether we actually need this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions