Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for pub/sub for peer subscribe to all channels? #42

Closed
1 task done
kashalls opened this issue Jun 3, 2024 · 1 comment
Closed
1 task done

Add option for pub/sub for peer subscribe to all channels? #42

kashalls opened this issue Jun 3, 2024 · 1 comment

Comments

@kashalls
Copy link

kashalls commented Jun 3, 2024

Describe the feature

I don't see a way to list all known channels other than creating a set of strings. The part that is trouble is adding other peers to new channels as they are created or removed, etc...

export default defineWebSocketHandler({
   message(peer, message) {
       const data = JSON.parse(message.text())
       if (data.subscribe_to_all) {
           peer.subscribe("*")
      }
   }
})

I'd be willing to implement this if I was given a direction to go in.

Additional information

  • Would you be willing to help implement this feature?
@pi0
Copy link
Member

pi0 commented Aug 6, 2024

Hi dear @kashalls sorry for late reply. I think you can simply subscribe peers to * channel in upgrade hook and then use publish("*", msg) as a convention to do this on your application level.

I don't think core needs additional functionality for this but please feel free to ping me to discuss this if you wanted.

@pi0 pi0 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 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

No branches or pull requests

2 participants