Advice on messenger app

Hi,

I’m building a real-time messenger app. I’m thinking about using Firebase to store the data (please let me know if this isn’t the right solution for the situation I’m describing).

My question is, if there are multiple people using the app, and one person posts something that contains a keyword “watched” by other people, how do I do the “calculation” in the backend in real-time so that people watching the keyword get a notification that a message containing the keyword was posted?

I don’t need exact code, just a conceptual idea of the flow of logic to accomplish the task described above. If the description is unclear, please let me know. Any help or pointers is much appreciated. TIA!

Kamal

ps I’m posting in javascript because I’m using Quasar (Vue JS) Framework to build the app.

Firebase can work fine.

As far as keywords…

Presumably you are setting up sockets to communicate. Your server will know the keywords about which each of the users care.

It’s not clear to me if you want them to receive the message no matter what and just have a notification if one of those messages has a keyword. If that is the case, I’d probably do it client side.

If you only want the message sent if the keyword is there, then I’d just emit the event to that user with some kind of flag telling them the keyword was in there.

1 Like

Thanks for the quick reply, @kevinSmith.

I want the message sent only if it has the keyword. Where would I emit the event? It’s a mobile chat app so it wouldn’t be the client (sending or receiving the message). I don’t think I could do it through Firebase, or can I? Would I need a server running a process looking at all incoming messages and route them accordingly? It’d be nice to have an efficient, scalable solution. :slight_smile:

I don’t think I could do it through Firebase, or can I?

I think of FB as a DB, but I think I saw that you can run microservices on it. That could work.

It’s a mobile chat app so it wouldn’t be the client (sending or receiving the message)

The users will be clients.

Would I need a server running a process looking at all incoming messages and route them accordingly?

Yeah, basically.

You will have a server. Each client logs in (or whatever) and will make a socket connection with the server. The clients can send messages to the server and the server can decide to whom it wants to send those.

1 Like

Thanks again, @kevinSmith. I think you’ve put me on the right track. Firebase has Cloud Functions that seems like it might work. Time to do some learning. :nerd_face:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.