Environment
node@22.14.0
nuxt@4.0.3
→ h3@@1.15.4
→ crossws@0.3.5
Reproduction
Use peer.publish
Describe the bug
According to the documentation, peer.publish broadcasts a message to the subscribers of the given channel. However, I noticed that the peer that triggered the publish itself never received the message, even though it was subscribed to the channel.
Additional context
On closer look, it looks like this was implemented intentionally here:
|
if (peer !== this && peer._topics.has(topic)) { |
as it explicitly checks if the peer isn't the current peer before sending the message. Not entirely sure if this is a bug or a 'feature'; depending on that this is either a bug report or a request for better documentation. Happy to open a PR for either of those :)
Logs
Environment
node@22.14.0Reproduction
Use
peer.publishDescribe the bug
According to the documentation,
peer.publishbroadcasts a message to the subscribers of the given channel. However, I noticed that the peer that triggered the publish itself never received the message, even though it was subscribed to the channel.Additional context
On closer look, it looks like this was implemented intentionally here:
crossws/src/adapters/node.ts
Line 179 in 84cf679
as it explicitly checks if the peer isn't the current peer before sending the message. Not entirely sure if this is a bug or a 'feature'; depending on that this is either a bug report or a request for better documentation. Happy to open a PR for either of those :)
Logs