My iOS/Parse app allows multiple users to modify data which is shared among everyone. So if user 1 modifies the data I want the rest of the users to be notified of the change so that they can request the new data. I'd like this to happen in the background. So, if I have the app open and other user makes a change I want to get those changes as soon as possible (kind of like a shared notes app).
Does Parse support this type of data modification notification? If it doesn't I'd have to do something ugly like periodically poll for changes. :-(
Related
I have an iOS app powered by a Realm Object Server hosted on Amazon and I am curious as to when syncing actually occurs. Is syncing lazy on queries, real-time for all open realms, or something else?
For example, let's say I have a realm called /common and all SyncUsers have read/write permissions to this realm. Each active SyncUser also has a notification block listening to a GlobalProfile object in the /common realm corresponding to their SyncUser identity. If one user makes changes to another user's GlobalProfile object, will all users download this change immediately, or will only the user with the notification block on this object immediately download the change?
Specifically, I want to create a way for a user (let's name it Tom) to search for other users and send them read/write permissions to Tom's realm. My current solution is a public realm in which each user adds a GlobalProfile object. To search for a user named Jerry, Tom can simply query the public realm. To grant Jerry read/write permissions to Tom's realm, Tom can write a SyncPermissionOffer.token into Jerry's GlobalProfile. Because Jerry has a notification block listening to his GlobalProfile, he will be immediately notified of this token and can accept the SyncPermissionOffer to Tom's realm. My worry, however, is that all users, not just Jerry, will sync this change in the /common realm, which is unnecessary. If the app has 100,000 users, I don't want each user to constantly sync all SyncPermissionOffer tokens being sent between other users.
Please let me know if this question is not clear. Thank you so much for the help!
Sync is real-time on all changes. Sync is not waiting for, or contingent on, a notification block. The notification block is executed locally and is not used to alter the client-server communication in any way.
If you have a /common Realm, it will contain all your permission offers and
all users will download all other users permission offers. It will grow large over time.
What you could do is to have a /common Realm that only contains the user ids, their "names", and a path to their "inbox" Realm. When user A wants to
invite user B, A looks up B in /common, obtains the Realm path for B's inbox, and sends a permission offer to that.
With this approach, the common Realm would not grow that big, because the data par user could be kept below 100 bytes, say.
I have a fully functioning application that uses Firebase as a backend. I want to be able to have a user receive a notification when a child is added to my Firebase database under that users ID.
I have looked everywhere but all I can find are links to OneSignal or people telling me to "make a custom server" as if it can be done by magic. How do I go about making a server? What language? What do I do with OneSignal? Can someone guide me step by step without telling me to simple make a custom server.
I believe Cloud Functions for Firebase is exactly what you're looking for. Specifically, Realtime Database Triggers:
The Realtime Database supports the onWrite() event, which triggers anytime data is created, destroyed, or changed in a specified database location.
In a typical lifecycle, a Firebase Realtime Database function does the following:
Waits for changes to a particular database location for write events.
Fires when a write event occurs and performs its tasks (see What can I do with Cloud Functions? for examples of use cases).
Receives an event data object that contains two snapshots of the data stored at the specified path: one with the original data prior to the change, and one with the new data.
And going through the What can I do with Cloud Functions?, theres Notifying users:
Notify users when something interesting happens
Developers can use Cloud Functions to keep users engaged and up to date with relevant information about an app. Consider, for example, an app that allows users to follow one another's activities in the app. In such an app, a function triggered by Realtime Database writes to store new followers could create Firebase Cloud Messaging (FCM) notifications to let the appropriate users know that they have gained new followers.
The function triggers on writes to the Realtime Database path where followers are stored.
The function composes a message to send via FCM.
FCM sends the notification message to the user's device.
To review working code, see Send FCM notifications.
Other interesting notification use cases
Send confirmation emails to users subscribing/unsubscribing to a newsletter.
Send a welcome email when a user completes signup.
Send an SMS confirmation when a user creates a new account.
I know that Realm offers two way syncing and can trigger server-side events when data changes.
I am making a sort of messaging app, my question is how would I implement it so that when someone writes a message (which will update the DB), how does this message immediately display on other devices?
All you have to do is to open the same Realm on all devices, then they will all see the changes instantly as they happen (as long as they are connected of course :-)).
Check out the tutorial, it shows the data being realtime synced between both an iOS app, a Mac app and the Realm Browser: https://realm.io/docs/tutorials/realmtasks/
I'm one of the developers working on Realm Tasks, incorporating the latest features of the Realm Mobile Platform into it. :)
Making a chat app has become significantly easier with the release of client Realm sharing in Realm 2.3.
To make a chat app, the logic flow would be something like this:
A user starts a new chat room. This would be represented in RMP as a single, private Realm file belonging to that user.
The user can then invite other users access to that chat room via the sharing mechanism.
Every user can then contribute messages. Each message would be a separate Realm Object written to the shared Realm.
Each time a new chat message object is written to the Realm, it would be synchronized with every other user in the room.
Please let me know if you need any additional clarification.
I am creating an app which using address book.I am sending all my contacts to server each time to get the list of contacts who all are using the app and I should get the notification for new users in my contacts.I don’t think it is an effective way(sending all contacts everytime).Can any one suggest me how to handle the scenarios like edit contact,delete contact.How to avoid the sending of all contacts to server each time when I am opening the app.Also suggest me an effective algorithm to make best app
You could just send the changed contact to the server, use an additional field like, status and save this status from the last time you sync to server, if a contact created, or edited or deleted, you just need to change this field to not sync, and when you sending data to the server, send this not synced data to the server.
I'm developing an application which holds a list of objects.
The user should be able to favorite some of these objects, which then gets saved for easy access. Simple enough, right.
However, in addition to that, I want it so that the application notifies the user (using a notification, like when you get a new SMS), whenever one of the favorited objects have had something changed (in my application the objects represent a pub, and a change to the pub is when it has a new event scheduled). The change is done on a remote server, using a webpage.
When my app is active I can just poll the server every few minutes and compare the properties of the object, and if I see a change notify the user.
But how will I do to make this work when my app is NOT in the foreground? I want the user to get a notification even if he/she is not currently running my app.
The app does not have any login-functionality, so I can't send out specific push notifications to specific users. So the only thing the server might have access to is perhaps the device ID. I.e. there is no real way for the server to know which favorites a device ID holds.
Is there some smart way to do this? On Android I can just use polling but as iOS doesn't allow code to run in the background in the same way I don't really know how to do.
All help greatly appreciated. Even if it's just a "I don't think that's possible".
Just create a table that associates device ID with favorites. When a favorite changes, send that device ID a push notification
The user is the device ID