ably / ably-js

Javascript, Node, Typescript, React, React Native client library SDK for Ably realtime messaging service
https://ably.com/download
Apache License 2.0
303 stars 55 forks source link

Feature Request: Programmatically detach a client from channel. #1744

Open Dajust opened 2 months ago

Dajust commented 2 months ago

Similar to using presence.leaveClient to remove a client from a presence, we should have a way to detach a client from a channel. Something like channel.detachClient(client123).

Use Case: In a chat application, an admin might want to remove a participant from the chat room.

Current workaround: Currently we have to signal the client to detach from the chat room.

┆Issue is synchronized with this Jira Task by Unito

ttypic commented 2 months ago

Hey @Dajust, thanks for bringing this to our attention! Right now, the recommended way to implement this is using token auth and the capabilities feature. In case a moderator wants to change a user’s permissions, the backend can revoke the current token and issue a new one with adjusted capabilities. Would this work for you?

Dajust commented 2 months ago

Thanks for your response @ttypic. But the capabilities stuff doesn't quite work for my case. I want to remove a client from a channel, not block them from future access to the channel. Similar to how presence.leaveClient doesn't prevent the client from re-entering the presence. I think I'll continue using my workaround for now. Thanks.

ttypic commented 2 months ago

@Dajust Could you tell us more about your use case? Why might an admin want to remove a participant from the chat but not prevent them from re-entering?