it is possible to create a reference point in time using Xano? (chat basic notifications)
Hello,
I have developed a chat application and I am trying to implement a feature where notifications are sent when a message is received by the intended recipient. To achieve this, I have two databases - one contains chatroom IDs and the IDs of the two users involved, while the other contains the messages, including the creation time, user ID, message content, and chatroom ID.
All messages between the two users are displayed in a message datatable in chronological order, based on the creation time. I would like to be able to track the number of messages sent by each user after the last message received from the other user.
My question is whether it is possible to create a reference point in time using Xano and how to filter the messages to identify the last message sent by each user based on the last message received from the other user?
Answers
-
Hey @Ray Deck any ideas for this one?
-
Not sure I understand it completely, but maybe instead of using time as an indicator to determine number of messages from the last one received (be received do you mean seen by the user?). You can create additional boolean field "seen" or "recevived" with False value and on event of opening the chat you go through those messeges and change this parameter to True to reset the count.
-
@Pawel Magdanski thank you for your feedback, this is indeed a very interesting approach I didn't think about but which could actually work
-
@Pawel Magdanski 's approach is what most DM/PM systems use - a "read" or "delivered" boolean that you can check against and update as they get loaded in. (The methodology gets weirder for group chat, but that doesn't seem to be the case here.)
It's simpler to manage, and far more performant than setting up for a range-based database query.
You could do the date math you describe, but whenever you start asking about complex ranges, an alarm bell should be going off that there is probably a simpler way - and in this case there is! -
Thank you both! 🙏
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback