Random Chat App

I’m building random chat app. When somebody presses a certain button, they are taken to a chat room where I want them to join another person who pressed the same button. It’s like Omegle, except for chat rooms.

Here’s what it looks like from a database standpoint:
I’ve got chat data…

And I’ve also got message data…

I didn’t think I’d need anything more since I’m not saving any data. Once somebody leaves the chat room, it’s over.
Right now I’m encountering a problem workflow wise. I have this for when a person presses the button to join a chat room:
After pressing the button, workflow step 1 is…

Workflow step 2 is…

What would be the next step? So far we’ve created a new chat and we’ve navigated them to the chat room page (a page with a chat box). How do I ensure they’ve found a room with a random person who also clicked the button? Also, when one person leaves, how do I ensure both parties are sent back to the home screen?

Thank you for your help, I’m open to any 1 on 1’s as well.

I think your first step should be to add the user to an available chat room.

If there is no available chat room then create a room and notify the user to wait.

How do I know if a chat room is available or not? Are you saying I should change the first part of my workflow?

The chat room is available if there is only one member in the room.

You can Do a search for any chat that the count of all users is 1 to find the available chat room

I mean like as my first step I’d look for rooms with one person. I’m not sure how I’d go about doing this?

This topic was automatically closed after 70 days. New replies are no longer allowed.