Hey, i’m creating an e-commerce app like amazon and wanted to add a feature to it:
How can I create a button on the product page that says “Contact Seller”
When clicked it should create a conversation between the buyer and the seller where they can chat about the product and sell it.
In terms of database, relationships and click actions. How can this be made possible?
What i’m mainly stuck at: When I add a relationship with “User” and “Conversation”
Should I do this twice to add “Seller” once and then “Buyer” the second time? (One to many)
I recently implemented a similar functionality. I thought about the many-to-many collections approach but somehow couldn’t make it work to properly manage an “unread” status and display Icons accordingly.
I ended up using two one-to-many fields for the two participants in the conversation and two unread fields for both participants.
Now that I think of it, I might give the many-to-many approach another try.
@njimmy10 not very helpful! can you please explain?!
@Victor I’ve seen your great video on chat app enhancements. My problem is, that the unread and read status is only updated upon a refresh of the website and not immediately. The same goes for new messages, they are only displayed upon reloading the app.
Also: if the messages are sorted chronologically (latest message at the bottom), how can I tell the list component to scroll down to the bottom or start at the bottom (like whatsapp)?
As for the Reverse Scrolling: this actually loads the normal way but then just scrolls down to the bottom, “bouncing” up and down several times when the end is reached. looks like a cheap workaround to me which probably doesn’t work along with “only load & display visible items” and will most likely result in poor performance in longer chats.
As for the Auto-Refresh: I have had auto-refresh turned on, and it does work quite well on the chat screen. I do, however, have a text component on the message overview where the last message of each chat is displayed, and this doesn’t get updated automatically when another user writes a message although I have auto-refresh on for both nested lists. I need to reload the app in order for the last message (and the unread status) to be updated.
@Victor, I’ll give your suggestion for the junction table a try as soon as I notice performance problems, but the chat probably won’t be too big anyways.