Skip to content
Back

AppWrite Limitations

  • 0
  • Android
  • Databases
Shivam
5 Jan, 2025, 05:15

I am not sure but as I am working more on my project with AppWrite, I face many new things which I think not possible with AppWrite. After getting overcooked with AppWrite Messaging, I thought to handle Notifications with my own logic. And to do this I need to store each session FCM token in database. So, let's get started with the database structure I want to use: At First, I have a Single Database named as "Database" Inside that I have two collections named as "Users" and "Tokens". As the name suggest Users collection just stores the authenticated user basic details. No problem with this collection.

In the Tokens collections, I want to document like this "User1", "User2", "User3".... Inside each user I want to create something like key value pair. Like

TypeScript
"Session1" : "token1",
"Session2" : "token2",
"Session3" : "token3",
"Session4" : "token4",

Is it possible to create such scenario in AppWrite? I think No. What's your thought?

TL;DR
Developers are discussing handling multiple sessions in an app and the limitations faced when using AppWrite Messaging. The proposed solution involves creating a database structure with two collections, one for users and one for tokens. It suggests storing each FCM token in the Tokens collection under a key-value pair for each session. The issue lies in whether AppWrite can accommodate this specific scenario. The proposal suggests creating separate attributes for tokens and implementing a workflow to manage them.
Shivam
5 Jan, 2025, 05:23

It's true AppWrite helps me too in many places, but it also doesn't leave to frustrate me😢 Let's see what its developer says.

Axistro
5 Jan, 2025, 05:38

Why need muliple session token? Why not have a single doc that updates everytime when a user logs in. Say you have a collection of tokens to send notifications. Every token corresponds to each user. As much as I know the token is connected to the device. I will tell you what is my workflow. If a user logs in or creates acc I call the function to getToken. As token exist. Now i call from a function if a doc in the token collection exist of the user. If yes i just modify it with current one else i just create a new doc with the new token. This token lasts untill the app is deleted from the phone. So say if you want to send a notification to me you can search for the doc that is related to my userid and use the token to send a notification to me.

Axistro
5 Jan, 2025, 05:39

The limit is if the user can have multiple login at same time in different phone, the token would just be related to the one that was new in login

Shivam
5 Jan, 2025, 05:40

Yeah thats the problem. I want to send notification to all logged in device

Axistro
5 Jan, 2025, 05:44

In this case you can keep 3-4 more attribute saying Token1,token2,token3, and 3-4 more datetime attribute to check when these token were created token1time,token2time.... Then if the first is empty, you fill that, then go to second and then 3rd. Say you have 5 logged in devices When he logs in 5th time. You just modify it make the 1st attribute value and continue again. This is a bit complecated but i dont think anyone would have more than 5 login at same time

Axistro
5 Jan, 2025, 05:45

You could add an array of these tokens but you would have to stringify the array when saving in appwrite and pharse the doc attribute to get the array again

Axistro
5 Jan, 2025, 05:46

And about saving tokens. Its not related to appwrite but its related to firebase 🫥

Shivam
5 Jan, 2025, 05:48

Yeah that workaround may work. 5 attribute may work.

Shivam
5 Jan, 2025, 05:50

Previously I was trying with AppWrite Messaging, but it does nothing beside of cooking me🥵 I got overcooked in handling multiple session🤯

Axistro
5 Jan, 2025, 05:50

Why do you want to handle with multiple login. Why not just limit to one?

Axistro
5 Jan, 2025, 05:51

Although it is free to send any amount of notification

Shivam
5 Jan, 2025, 05:55

There's many scenario where it require to handle multiple session. Two big example will be email app, or whats app

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more