do I need to resubscribe to market data after reset? - quickfixj

I am using quickfixj to subscribe to market data. Noticed that after midnight reset, I will not receiving incremental anymore. How do I know if I am still subscribed to the the session?
Do I need to resubscribe each time when I logged on again?

It of course depends on the target system that you're connecting to. Some systems will maintain subscriptions across sessions, but the vast majority will not.
You probably need to resubscribe.

This is a bit late, but I figured out that I need to resubscribe. Since the initiator is not down but the acceptor is down at that period of time. When Accepter started, the initiator was still trying to connect, once connected, the subscription is not triggered.
So the solution is to add subscription in the onLogon callback, so each time it got logged on, it will try to subscribe again, so the stream is not lost.

Related

Why did my cloud run eventarc trigger lose it's topic subscription?

I have a cloud run service deployed, with an eventarc trigger which creates a pubsub topic behind the scenes, to which the trigger is subscribed.
Recently to my horror I noticed the trigger was not being invoked anymore. Looking further I noticed there were 0 subscriptions to the pubsub topic. I went to the cloud run service console and the trigger still existed, so why no subscription to the topic?
I have redeployed the service multiple times before, and the subscription has never disappeared like this. Deleting and re-creating the trigger brought back the subscription, however now I lost all my messages. :-(
Can anyone explain how this could happen, and if it does happen again, how I can re-enable the subscription without re-creating the trigger and thus losing all my pubsub messages?
Thank you very much.
Pub/Sub subscriptions created by Eventarc triggers should definitely not expire. If you see this again, please open a bug with details: https://cloud.google.com/support/docs/issue-trackers
I received this message from the engineering team:
"As of May 3rd, pubsub subscriptions created by creating an Eventarc trigger are set to never expire. Previously, they had a default expiration of 30 days of inactivity.
It sounds like what the customer is experiencing is consistent with that. What happened was there were 30 days of inactivity and the subscription expired.
The workaround at the moment would be to create a new trigger."

Running small periodical high-priority background taks on iOS

App that I am working on is offering a VPN connection, that can run even when the app is not running at all. This service is paid, but also I would like to offer a free trial limited by session length and maximum data transfered.
The problem I've encoutered, is with monitoring the data trasnfered when the app is in background or not runing at all. So far the best solution I've came up with, would be to periodically run small task that checks if the user is still within the data limit and if not, the VPN will be disconnected and notification shown to the user.
Will silent notification get priority every time it will be required? According to this quote from developer.apple.com, they are low-priority which isn't what I need, but I was unable to find anything else.
Silent notifications are not meant as a way to keep your app awake in the background, nor are they meant for high priority updates. APNs treats silent notifications as low priority and may throttle their delivery altogether if the total number becomes excessive. The actual limits are dynamic and can change based on conditions, but try not to send more than a few notifications per hour.
How can this be done reliably? Is there any other way?
If this is a personal VPN connection (i.e. you're just providing a config to the standard system) and you're not in the flow, then this isn't possible. There is intentionally no "I want my program to run all the time" solution. Even if you come up with one, Apple will probably shut you down.
If you're writing an MDM/supervised VPN connection (i.e. you're providing a ...Flow object of your own), then you're already running all the time and you can just control it as you want. I'm assuming you have the former or you wouldn't be asking.
I believe you're doing this backwards. Monitor the session length on the server, and disconnect there. When you disconnect, send a push notification, which can display a message directly without having to open the app. That is both robust and the intended solution.
Periodically posting a silent notification to wake yourself up will definitely not work because Apple specifically does not want you to do that and they explicitly break it (as they note "silent notifications are not meant as a way to keep your app awake in the background"). It's bad for battery life. This is intended to be solved on your sever, on on the user's device.

iOS iap restore process on multiple devices - SKReceiptRefreshRequest or restoreCompletedTransactions etc

I know there is a lot of info but I sill can't decide what is the proper way of restoring IAP subscriptions between devices. Obviously, after digging the net, there is no really good documentation about this and people have to deal with it mainly by trials and errors.
I'm on the point to finalyze my first app with IAP subscriptions and have some doubts before I'm ready to upload it for approval. It seems like the behaviour during testing is quite different than the production one and I just don't have the production experience yet to be sure what is going on exactly.
The way I have implemented the process is the following:
The user purchase the item for first time so he/she makes a payment and the transaction is added to the queue.
When the app receives the response it calls finishTransaction and validates the receipt (it can be local or remote but it's a different question)
When the renewal comes the queue notifies the app and the app again calls finishTransaction and makes a new validation.
This works fine on one device and there are no problems.
However when I want to restore those purchases on another device the renewal notification might not be sent as the first device that receives the notification calls finishTransaction and all other devices just miss it.
Then I have two options - either to refresh the receipt by using SKReceiptRefreshRequest or restoring the purchases by using restoreCompletedTransactions. I make one of these at a certain time based on the previous purchase expiration date just to check if the user didn't stop the subscription. (Subscription cancelation is another topic - similar but for now I don't mind it)
The refresh process looks like the one I prefer but, at least in Sandbox, it always asks the user to log in (twice and I don't know if it's normal, plus that in sandbox I couldn't find a way to implement the Touch ID). Then the app receives a new refreshed receipt and goes through the validation process which is great.
The second method requests silently a new receipt (which is a plus over the previous) but as far as I can understand it always doubles the amount of transactions in the new receipt as it make a new transaction for every completed one:
The payment queue will deliver a new transaction for each previously
completed transaction that can be restored. Each transaction includes
a copy of the original transaction.
So... my questions are:
Is the production behaviour the same like the sandbox for the SKReceiptRefreshRequest - should the user sign in every time the app wants to refresh the receipt and does integrating Touch ID requires some other implementation?
If I have, let's say Week Subscriptions, it would be quite annoying to the user.
If I use restoreCompletedTransactions will the receipt at some point becomes full of useless transactions?
If the user had, again let's say one year of Week Subscriptions and restores them on a few other devices, they all will fill up the final receipt quite a lot.
Overall which method is preferable and what are the Pros and Cons for each of them.
Thanks a lot!

Best way to notify iOS app on server database updates

I am quite new into programming and I cant find efficient solution for my problem. Could someone point me in the right direction please?
I have an app which is heavily relying on server data. Data on server is unique for each user and may change every minute as well as only every few hours. Currently I am updating local data when app becomes active but I also need a way of notifying app to trigger updates when app stays in active state and data has changed on server. I thought about few solutions:
1) NSTimer set to one minute and triggering url request to check if there is new data on server. Server after comparing lastModified value would return new data if available.
I don't really like that solution as I don't want to overload my server with number of requests, especially that data in the database may change only every few hours or even longer.
2) APNS - sending notifications from server every time data will change and than update local data with server database when notification received.
It seems like a good solution but only if it would be possible to restrict remote notifications to be received when app is in active state. As far I know it is not possible and as I mentioned before data may change even every minute so I don't want to spam users with number of notifications when app is not running.
3) TCP Sockets using NSStream/CFStream?
This is something I never did before, so I am not even sure if I am going in the right direction researching about this one.
This is a hard topic in general, but more technologies are coming out to help with it. Couple thoughts on each of your solutions:
The NSTimer solution is effectively polling, which is the worst option I feel. You'd be hitting your server pretty hard for each user.
This would be a better solution. APNS now supports silent notifications, so you can send push notifications to a user without worrying about notifying them. You can send a silent notification by including the content-available key in the payload and not including the alert key. More info here: http://hayageek.com/ios-silent-push-notifications/. It is rate limited, though. You may go minutes to hours without getting a delivery, so if that's important you'd be best to go to option 3.
This is your best solution. It would require a persistent connection with your server. AFNetworking 2.0 supports this kind of connection based on Rocket. Here's Rocket's documentation: http://rocket.github.io. Take a look at server-sent events.
Hope that helps!

GKScores are stored until next connection?

In Apple's GKLeaderboards sample code they show how to store GKScore objects for later submission when they fail to send. However, the documentation for Reporting Scores To Game Center says "If for some reason the score could not be reported because of a network error, Game Kit automatically resends the data when the network becomes available."
Does this mean that the resend infrastructure in GKLeaderboards is no longer necessary? In which version did GameKit start saving and resending scores to the leader board?
I haven't used GameKit until just recently, so I'm hoping someone has been using it for a while and can confirm it to save me some testing.
In my experience I've never had to implement coeds to resend scores that were not able to be sent when a connection was down!
All data shows that with the automated resending, you and I no longer have to resend the data manually! :)
That's a relief.

Resources