adonis-websocket icon indicating copy to clipboard operation
adonis-websocket copied to clipboard

broadcast

Open vityukBogdan opened this issue 5 years ago • 5 comments

vityukBogdan avatar May 15 '19 11:05 vityukBogdan

Coverage Status

Coverage remained the same at 93.703% when pulling 5029c1d93e4c491d17298fb905c6ffab59ba6282 on vityukBogdan:broadcast into 1d99b9ad81322a4197dcf2ed638f5bd071cf3842 on adonisjs:develop.

coveralls avatar May 15 '19 11:05 coveralls

Coverage Status

Coverage remained the same at 93.703% when pulling 5029c1d93e4c491d17298fb905c6ffab59ba6282 on vityukBogdan:broadcast into 1d99b9ad81322a4197dcf2ed638f5bd071cf3842 on adonisjs:develop.

coveralls avatar May 15 '19 11:05 coveralls

It seems that this change could break some code. Therefore, it will not be merge right now

RomainLanz avatar May 27 '19 08:05 RomainLanz

Infact, the current behavior is correct. Here's why

const topic = Ws.getChannel('chat').topic('watercooler')

Now you have access to all the sockets subscribed to watercooler topic. When you say topic.broadcast(), you don't know which socket to ignore. So the message must go to all the sockets

thetutlage avatar May 27 '19 09:05 thetutlage

I have a http controller that is using topic.broadcast(). I'm very surprised to see that it's broadcasting the event also to the client that sent the HTTP request. Why is that the case and how could I exclude the client that's connected to the topic who sent the HTTP request?

CodingDive avatar Jun 07 '20 20:06 CodingDive