I need some Tipps to solve a Account/User "Problem" (Creating a Chat-App)
- 0
- Web
- Databases
- Accounts
- Self Hosted
- Users
I want to create a chat web app. So far I only work with the Web SDK (Angular) and all database/auth services work very well.
Now I probably lack the right knowledge (I have ->still<- little Node.js or backend experience) to understand how to develop a dynamic chat app. Statically this would not be a problem:
Let's say there are fixed chat rooms with topics, and the users can register to chat. Then I would create a collection for each chatroom, where the messages would come in. The users would then be informed via appwrite function/realtime when there was new messages.... So far so good.
But if the users address each other directly....I can't create a collection for this 2-person chat in advance...This would have to happen dynamically, but it doesn't work with the Web Sdk.
I could simply build a collection for all chats, and then fish out the id of the respective chat messages....but that's not a good solution and would cost a lot of performance than if every direct chat had its own collection?!
I would like to have some ideas in which direction I have to learn further here? Completely different app structure, or use the Server SDK...do I then have to build my own API (with Server SDK, where the collections are created...) with which the clients then communicate?
Existing knowledge: Html/Css/Javascript (junior)/Typescript (junior) Framework Angular
In your opinion, what knowledge else would be important to add here in order to develop web apps really well with Angular + Appwrite?
Thanks very much <:appwritepeepo:902865250427215882>
Those two approaches are common in chat applications.
Usually most chat application uses a NoSQL databases to overcome this complicity precisely - as you can create much more dynamic room structure when you're not obligate to any.
That said, Appwrite although could look like a NoSQL database its still RDMBS one, so the best approach would be the second one and with indexing on some unique values as we can see next.
As for performances MariaDB is a pretty fast, and by using Index you can expect looking on O(log(N))
which means the search for index in 1B message should cost up to 10 searches.
So you can add index for the room ID in the messages collecion for fetching the messages.
The best way would be to utilize and use Appwrite teams, so the permission would work automatically read here about it: https://discord.com/channels/564160730845151244/1118234129037799507/1118531167017259178
The solution with teams looks good. So each direct chat would be a unique team. But what bothers me: Every team invitation has to be confirmed by email, also on the server side? Of course, that makes little sense in a chat app.
My idea was now: Create a collection for each direct chat user pair, then subscribe per realtime to "databases.[ID].collections.[ID].documents"....So each user has for each conversation one realtime-sub. (first without teams) - Could that work?
On a server side there is no need to confirm and the all adding/removing of the team is much more naturally and without even notifying the user.
Yes,
Ah, because: https://appwrite.io/docs/server/teams?sdk=nodejs-default#teamsCreateMembership HTTP Request, url:
URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an open redirect attack against your project API.
So this is required, but the url itself does not have to be used. Only if I also want to work with the email on the server side...
Thanks in advance for all the help <:appwritepeepo:902865250427215882>
Yes, the URL is actually not needed in server side, check this: https://github.com/appwrite/appwrite/issues/5676
Recommended threads
- custom domain with CloudFlare
Hi all, it seems that CloudFlare has blocked cross-domain CNAME link which made my app hostname which is in CloudFlare, unable to create a CNAME pointing to clo...
- Type Mismatch in AppwriteException
There is a discrepancy in the TypeScript type definitions for AppwriteException. The response property is defined as a string in the type definitions, but in pr...
- What Query's are valid for GetDocument?
Documentation shows that Queries are valid here, but doesn't explain which queries are valid. At first I presumed this to be a bug, but before creating a githu...