Multiple times Event subscribed when I clicked a page from Navigation Bar in ionic 3 . How to fix this? - ionic2

When first time app launch then one time event publish and one time subscribe but when I am calling same page from Navigation Bar then multiple times event subscribes like 4 , 5 times .
Anyone Know , How to fix this issue ? Thanks in advance.

Related

Google cloud Pub/Sub - subscriber not forwarding messages to dead letter topic

I am trying to configure dead letter topic for unack messages to handle failures gracefully, however, it doesn't seem to be working. I tried two approaches:
I created a dead letter topic and subscription through google cloud console but it didn't work, though all the permissions were granted and under dead lettering tab everything was blue tick. Also, the topic is a different topic from main topic.
Then, I tried to go completely through cloud shell. I created a new project and took a fresh start, still no luck. I followed each and every step mentioned in the documentation here. All the commands were successful and got all the blue ticks again under dead lettering tab.
In both approaches --max-delivery-attempts=5. My understanding is that after 5 attempts subscriber should forward the message to dead letter topic automatically. However, this isn't happening and the unack messages are hanging around in subscription only.
Any help would be highly appreciated.
You need to active this options in your suscriptions:
enter image description here

How create alarm on SwiftUI watchOS

I want create alarm app for my apple watch but I don't know how to wake a person. There is an app - Sleep Cycle and they trigger something that looks like on picture:
Watch vibrates constantly like default timer app on apple watch. The question is what's the name of this interface element? This not a notification, not an Alert (https://developer.apple.com/documentation/swiftui/alert), not a WKInterfaceDevice play function. I just want reproduce that behavior. Thanks for help!
What you need is notifyUserWithHaptic, it gives a repeating haptic and also displays this notification style screen with Open and Stop buttons if the app isn't active.
As per Apple Docs
For schedulable sessions such as smart alarms, call this method during
the session to alert the user. When you call the method, the system
plays repeating haptic feedback. If the app isn’t active, the system
also displays a system alarm alert on the watch.
Link to Apple Documentation

How to send a "you haven't used your app in a while " push notification in React Native using AWS?

Just wanted to know from a high level how I would accomplish this.
I thought that when a user opens the application, I will keep track of the last opened time in a Dynamo DB table.
Then I could have a background worker constantly check and see if anybody hasn't used their app in 3 or 4 days and then send a push notification, ie, "you haven't used your app in a while, why don't you open it up and do XYZ."
From a very high level, there are two possible ways:
1.) Local notifications (you don't need AWS for this):
You can schedule a local notification, every time the user opens up the app (or better - every time the user brings the app to foreground). It works like: User opens app -> cancel old scheduled notification if existing -> schedule new notification for "in 3 or 4 days" -> ready :-)
You can use something like this: https://github.com/zo0r/react-native-push-notification (see section Sheduled Notifications).
2.) You could do it with remote notifications (https://aws.amazon.com/sns/):
You can go the way you proposed. Then you have to store an entry in your db with the push notification token of the device and the last time the app was opened. Your worker then has to check and send the push message to the device using a service like SNS.
I would recommend 1.) over 2.) because you are independent from the users internet connection when getting the app opening info. In 2.) you can miss the opening info, when the user opens the app without internet connection. Also 2.) is more expensive then 1.) when you scale your app.
An advantage of 2.) would be, that you are more flexible when and what you send in your notification, since you can edit it on server side. 1.) would mean that it is coded in your app (at least until you build a synchronization mechanism for the variables) :-)

Django: Send reminder email

my app has list of events with start time (date and time). I want to make a scheduled task to send reminder via email to all user participate in event 1 hour before event start. (Note: Admin can change time of event).
I currently use celery to send email to list of participants when admin change the time of event.
Please suggest me some solution for this. Thanks.
Here's a recent(ish) discussion where a potential solution is proposed for celery: https://github.com/celery/celery/issues/4522.
I built Posthook to make solving these kinds of problems easier for developers. In your case, when a new event is created or the event time changes you can schedule a request back to your app for 1 hour before the start time. Then when you get the request from Posthook you can send out the reminder after validating that it still needs to be sent out.

Google Cloud Monitoring: Add an alert if Publish succeeds and subscribe fails

I want to add an alert on Google Cloud Monitoring such that, for a given topic and a subscription, I want to know if a topic is being published then subscriptions are not being acknowledged at the same or similar rate for a given time frame.
How do we achieve that using Alerts in Google Cloud Monitoring or StackDriver?
I have tried an approach where I have 2 conditions to satisfy:
If publish operations > 0.016/sec for 2 minutes (meaning atleast one
publish per minute)
If subscribe acknowledgments < 0.001/sec for 2 minutes (If no subscribe acknowledgements happening in 2 minutes)
Then, alert.
Whats happening here is, during low load, if there are no publishes happening say for a span of 3 minutes and a publish happens, both conditions 1 and 2 are set to be true and devs are alerted about this as failure.
So, what is the right way of designing such alerts?
If my approach is close to what I want, the next questions that come to my mind are,
Is there a way to say count your two minutes from the instance where
the publish happens to see if acknowledgement condition is
satisfying or not.
Or, is there a way to make the alert to wait for 2-3 minutes to see if the incident resolves, and then send an alert to devs.
Or, is there a way we can count the occurances of these conditions satisfying and then alert only if the occurances are more than 5 or 10 in a span of 15 minutes or something like that.
Sorry for the long post. But, any kind of help is appreciated.
In order to calculate frequency for tasks a time window of 2-3 minutes is used. So if you had 0 tasks for 2 minutes or longer this issue recurs. This is described in documentation about partial metrics. Also, there are workarounds inside this link.
You can try creating your own custom metrics.