I am a React Native developer currently working on a vehicle tracking app.
We want to develop a feature that allows users to exit the app, but continually be updated in the form of notifications when the vehicle moves (on average every 60 seconds).
I have been tasked with coming up the best way of integrating this. Our app already has push notifications set up with Firebase and we do use this to push out generic messages to the app.
My thinking is as follows:
When a user begins tracking a vehicle, the app should subscribe to a Firebase topic identified as the vehicle's registration. On the server side, each time an update comes in for a vehicle, send out a Firebase notification to that vehicle registration's topic, and then any users tracking it will be updated. When a user returns to the app and presses 'Stop tracking', the app unsubscribes from the topic.
In theory I think this would work. The reason I'm posting is I'm not sure it's the most efficient way. Our server received updates for over 1,000 vehicles every minute.
Any help/ideas would be gratefully received!
Related
I'm learning backend and API development and trying to understand how to implement some features from scratch without using any paid third party service.
I want to understand this concept from design as well as implementation pov. Please share if you have any resources where I can learn how to code the below service.
How to build in app notification service like one of these from scratch ?
Notification when user likes or comments on a post (Instagram, Twitter)
Notification when someone views your profile (Linkedin)
Notication when a channel you are subscribed to uploads a video (Youtube)
These are different from push notifications like
Notification when someone sends you a message (All chat apps)
Live status via notification of your delivery (Food delivery apps)
Push notifications need not be stored permanently in any database but what happens with in app notifications? How to build such service which is scalable too.
One possible solution I could think of is this, for notification on post like
User A has made a post.
User B likes their post.
From likePost API emit an event which will notify User A that User B liked their post, listen for these real time events on client side. This can be done via sockets.
Do not store any notifications in database, just update the notifications in UI on that event emitted by likePost API or listen to real time changes in likes attribute of a User's Post table (is this possible?) and update UI.
In UI just show all such notifications by fetching from likes and comments table.
But I wonder how scalable is this approach.
I searched but couldn't find any good resources regarding this, so please if anyone could explain this or provide link to any blog or videos it will be helpful.
(P.s. I'm an undergrad student and don't have experience in system design and architectures, just started learning about these so just curious)
Thanks.
apps like Facebook, Instagram and linkedIn provides web hook of notifications. Webhooks allow you to receive real-time HTTP notifications for subscribed events. This functionality is only available for applications with an approved use case for webhooks. Webhhook received as a notification when user comment on your post or like your post, a web hook can be used to retrieve the information of post, comment and commentor etc.
I am attaching a reference of LinkedIn web-hook.
https://learn.microsoft.com/en-us/linkedin/shared/api-guide/webhook-validation
I have an application which sends notification to its subscribers through telegram.
For someone to subscribe, he needs to add his request in my website and after that, to identify his self, he needs to start a conversation with my bot using a secret code generated by the server.
For example, whenever he completes his request he should click a button which leads him out of my website and to telegram's chat (using ), in the background, the website is making long-pool requests to the server to check whether the server received a notification from telegram with this secret code abcd and to get the chat id assosiated with the request so it could store the request with this specific chat id.
The process seems to work just fine for many users, but for minor amount of users it's not working, they are starting a conversation with my bot but not getting any feedback about a success. It seems as whenever they leave the website (or the browser) and follow the path of the link (https://t.me/mybot?start=abcd) straight to telegram app, the long-pool is being stopped.does that happen sometimes when long-polling?
We have vehicle positions for over 10,000 vehicles currently coming into a Firebase Realtime database. Each vehicle is updated every 5 seconds on average.
I have been tasked with setting up a notification system with an app that allows these vehicles to be tracked.
If a user loads the app and begins tracking a vehicle by tapping on it, and then the app goes into the background, they should receive notifications every time the vehicle moves.
My Proposal
When a user begins tracking a vehicle, have them subscribe to a FCM topic with the topic name being the vehicle registration.
When our vehicle parsing script processes an update for a vehicle, if it has moved from its last location, send a notification to the topic.
When the user stops tracking the vehicle, unsubscribe from the topic.
Is this the best way of managing notifications for a Firebase setup?
Topics are optimized for having a reasonable small number of topics with a reasonably large number of subscribers. While your use-case seems a bit different, having a topic per vehicle should technically work fine.
I'm working on an app which allows users to confirm they attended a google calendar event. I'd like them to make the confirmation immediately after the end time of the event.
Will subscription to Google's event push notifications (https://developers.google.com/google-apps/calendar/v3/reference/events/watch) let me know when the event is over?
If not, what's the best way to solve the above problem?
Push notifications only let you know about changes on the calendar (someone moved the event, someone responded etc.). There are no push notifications at starts and ends of events.
You can still combine storing the events and watching the changes to them with having a cron job (or similar) to run your code when events end.
I am developing an addon for Shopify platform and using the Shopify NET library I have managed to authorize the user shop and gather some data.
Now I need to charge the usage of the Addon with a monthly fee (providing 7 days trial) but I cannot figure out the flow I must follow.
I guess that I have to call Recurring Application Charge API after the user authenticates (at the callback from the authorization URL) and if the user declines the charge then I have to log him out. Is that correct?
Do I have to care for providing 7 days trial by myself or the Shopify RACharge API with manage it by itself?
What do I have to do when the user cancel the subscription or freeze it?
Can anyone point me out a document that analyze the charging flow except the Shopify Billing API which is not that helpful after all?
First question, you're right. You either have to log out the user or you just let him authed without permission to see some views or all of them.
There's a propperty on Recurring Application which allows you to define the days of the trial: "Number of days that the customer is eligible for a free trial.", so Shopify handles this for you.
When user cancels a subscription or his store is put on "frozen" status, you should make sure he doesn't have access to your App functionalities, though if it's frozen, he won't even be able to log into his store.