dappros / ethora

A 'super app' engine for your project. React Native (iOS, Android) and React.js (Web, desktop). Social Sign In 🄵, Messaging 💬 (chat, voice, push notifications), Web3 Wallet 🪪 (profile QR, documents, coins, NFT), DLT 🔐 (provenance, crypto signing), Gamification 🤩, Social Commerce and more.
https://ethora.com/
GNU Affero General Public License v3.0
400 stars 74 forks source link

view room without joining #450

Closed seshubonam closed 1 year ago

seshubonam commented 1 year ago
  1. first question: is it possible to view room without joining

  2. second question with context: the feature im looking to implement in my app is:

my app auto-plays voice notes from a room in the sequence they are posted to that room,

users can text chat by clicking on a message box below the voice note and can send text messages but only selected users can post voice notes to that room.

could this level of customization be possible.

phwizard commented 1 year ago

Question 1:

There is a public room / channel and you'd like users to be able to see the contents before they decide to join?

Are there going to be invite-only rooms / channels like this? I.e. do you want all users who have a valid room link / QR code to be able to see the contents without joining or would it be restricted somehow?

Technically you are supposed to join the room first. We're using XMPP messaging protocol and user is supposed to join the room to become a subscriber of that room.

However we can add an API or some other mechanism to 'preview' rooms messages prior to joining if it helps.

The way you could implement this yourself (without our involvement) is create your own backend service / API / chat bot that uses a system User account in the system, reads all chat messages and publishes them via your custom API or writes to your custom DB for your client app to display prior to joining.

However we'll be happy to assist here so that you don't have to create additional backend logic. We were planning to create an API for chat history so that clients can retrieve the paginated chat history faster for any given chat room, however we found out it works pretty fast directly via XMPP so we didn't do that. For a use case like yours we can implement that API pretty quickly.

Once you confirm your preferred permissions approach here, we can iterate on this.

Question 2:

I think this question boils down to having two (or more) different roles or permission types for your room users.

In Ethora platform there are 3 different mechanisms that could potentially be used for that: 1) XMPP roles (roles such as Admin, Moderator of the XMPP chat room) 2) User Tags - users can be assigned various tags and then client/backend logic can use tags for matching, sorting, permissions etc 3) ACL - a mechanism of permissions flags to regulate users access to resources

Now,

For comments under voice notes you could use the existing mechanism of Threads or implement your own custom marker to chat stanzas. So that it's threaded / nested correctly in your UI.

We'll be happy to assist with some examples and specifics.

Let me know what you think - any further considerations to take into account here? If the above sounds good, we will get in touch here with some examples / suggestions for implementation.

@seshubonam

seshubonam commented 1 year ago

checking and will get back in 2 hours. thanks

seshubonam commented 1 year ago

Question 1:

There is a public room / channel and you'd like users to be able to see the contents before they decide to join?

Are there going to be invite-only rooms / channels like this? I.e. do you want all users who have a valid room link / QR code to be able to see the contents without joining or would it be restricted somehow?

Technically you are supposed to join the room first. We're using XMPP messaging protocol and user is supposed to join the room to become a subscriber of that room.

However we can add an API or some other mechanism to 'preview' rooms messages prior to joining if it helps.

The way you could implement this yourself (without our involvement) is create your own backend service / API / chat bot that uses a system User account in the system, reads all chat messages and publishes them via your custom API or writes to your custom DB for your client app to display prior to joining.

However we'll be happy to assist here so that you don't have to create additional backend logic. We were planning to create an API for chat history so that clients can retrieve the paginated chat history faster for any given chat room, however we found out it works pretty fast directly via XMPP so we didn't do that. For a use case like yours we can implement that API pretty quickly.

Once you confirm your preferred permissions approach here, we can iterate on this.

Question 2:

I think this question boils down to having two (or more) different roles or permission types for your room users.

In Ethora platform there are 3 different mechanisms that could potentially be used for that: 1) XMPP roles (roles such as Admin, Moderator of the XMPP chat room) 2) User Tags - users can be assigned various tags and then client/backend logic can use tags for matching, sorting, permissions etc 3) ACL - a mechanism of permissions flags to regulate users access to resources

Now,

  • XMPP way - the creator and Admin of the chat room can assign other Admins and Moderators. You could for example make it so audio messages are only available to create for Moderators. XMPP role is already available for the client code so you can do a change in the client code disabling voice messages for non-Moderators, for example.

  • User Tags and ACL way is also possible, however for me looks like XMPP way is easier and more straightforward unless there are some other considerations to take into account here.

For comments under voice notes you could use the existing mechanism of Threads or implement your own custom marker to chat stanzas. So that it's threaded / nested correctly in your UI.

We'll be happy to assist with some examples and specifics.

Let me know what you think - any further considerations to take into account here? If the above sounds good, we will get in touch here with some examples / suggestions for implementation.

@seshubonam

thanks for the detailed response. specific use case is regarding question 2. so we can try implementing roles for users and giving permissions for text and voice notes.

as an example, these voice chat rooms will be like clubhouse but asynchronous, not livestream. but the moderation will be similar. clubhouse/twitter spaces have a "raise hand" feature to enable mic. so we would be implementing such a feature with user roles and permissions, as you described in your response for Q2.

phwizard commented 1 year ago

OK sounds good

@dendidibe can you provide some example of using a chat room role in React Native code

if we need to add more roles we can look into that

dendidibe commented 1 year ago

@seshubonam you can access user role in the room via presence stanza, here is the example request const presenceStanza = (from: string, to: string, xmpp: any) => { const presence = xml( 'presence', { from: from + '@' + DOMAIN, to: to + '/' + from, id: XMPP_TYPES.roomPresence, }, xml('x', 'http://jabber.org/protocol/muc'), ); xmpp.send(presence); }; also here https://github.com/dappros/ethora/blob/newArchitecture/client-reactnative/src/components/Modals/Chat/ChatLongTapUserActions.tsx#L136 you can see example usage of role

seshubonam commented 1 year ago

perfect, thanks. my dev is taking more time than usual for react native setup. new to the react native env. Will update progress next week on this. thanks for the help!

phwizard commented 1 year ago

sounds good - please feel free to ask any questions here or you could also use e-mail or Discord