centrifugo icon indicating copy to clipboard operation
centrifugo copied to clipboard

[question] Possible to ignore sending a message to a specific user within a channel?

Open garrensweet opened this issue 3 years ago • 2 comments

Basically, title.

I'm trying to replicate functionality that Ably and Pusher provide where it's possible to send a message to a channel, but prevent a user (for instance, the current user) from receiving the message.

The use case for this is to publish updates made to an entity by the current user to all other users.

Pusher/Ably do this by accepting a socket value which is the unique Socket ID assigned by the connection event. Centrifugo does provide that, so I'm wondering if there's a tie-in somewhere that can be made to replicate this functionality.

I've checked the centrifugo source but I'm not finding anything that would prevent a specific Socket ID from receiving a message.

Thanks!

garrensweet avatar Aug 27 '21 08:08 garrensweet

@garrensweet hello!

A couple of problems with this:

  1. Client can reconnect while message travels over wire/Backend/Centrifugo – in this case client has a chance to receive a message unexpectedly since it will have another client ID (socket ID).
  2. Client can call a history manually or message recovery process can run upon reconnect – in this case a message will present in a history

Both cases result in duplicate messages.

These reasons prevent me adding such functionality into Centrifugo, the correct application architecture requires having some sort of idempotent identifier which allow dealing with message duplicates.

Once added nobody will think about idempotency and this can lead to hard to catch/fix problems in an application.

Thoughts?

FZambia avatar Aug 27 '21 10:08 FZambia

Added this information to FAQ.

FZambia avatar Sep 02 '21 06:09 FZambia

Closing - given comments outlined here and information added to FAQ it seems that we won't add sth like this to Centrifugo. Current approach while being not very handy at first glance leads to a better app design at the end.

FZambia avatar Dec 05 '22 16:12 FZambia