Hello,
I am trying to modify the pulling interval of the subscription in the messaging service.
But I cannot find it, neither in the github repository, nor in the header files of the iOS SDK.
It is however documented in your Documentation for iOS (See attached file).
Is it deprecated or hidden somewhere i can’t find?
Thanks in advance.
Hi Bilal,
I am updating the Messaging docs this week, the subscription section is actually next…
Here’s the property to use to update the polling interval:
Regards,
Mark
Thanks for the answer.
In the old documentation, it seemed like the pollingFrequency could be adjusted on a “per subscription” basis.
- is that not possible anymore?
- if you change the property you link to, will it change the pollingFrequency for all subscriptions?
Thanks for your time.
Hi Bilal,
The ability to change polling interval on a “per subscription” basic has been returned.
Here is BESubscription class:
@interface BESubscription : NSObject
@property (strong, nonatomic) NSString *subscriptionId;
@property (strong, nonatomic) NSString *channelName;
@property (strong, nonatomic) id <IResponder> responder;
@property DeliveryMethodEnum deliveryMethod;
-(id)initWithChannelName:(NSString *)channelName responder:(id <IResponder>)subscriptionResponder;
-(id)initWithChannelName:(NSString *)channelName response:(void(^)(id))responseBlock error:(void(^)(Fault *))errorBlock;
+(id)subscription:(NSString *)channelName responder:(id <IResponder>)subscriptionResponder;
+(id)subscription:(NSString *)channelName response:(void(^)(id))responseBlock error:(void(^)(Fault *))errorBlock;
-(uint)getPollingInterval;
-(void)setPollingInterval:(uint)pollingIntervalMs;
-(void)cancel;
@end
When you have created or got the BESubscription object, its ‘pollingInterval’ private variable is been set by value of Backendless pollingFrequencyMs property. But you can change this default value using the method:
-(void)setPollingInterval:(uint)pollingIntervalMs;
For example:
func subscribe() {
Types.tryblock({ () -> Void in
let responder = Responder.init(responder: self, selResponseHandler: Selector("responseHandler:"), selErrorHandler: Selector("errorHandler:"))
let subscriptionOptions = SubscriptionOptions()
let subscription = self.backendless.messagingService.subscribe("weather_channel",
subscriptionResponder: responder, subscriptionOptions: subscriptionOptions)
subscription.setPollingInterval(60000) // 60000ms
print("SUBSCRIPTION: \(subscription)")
},
catchblock: { (exception) -> Void in
print("FAULT: \(exception as! Fault)")
}
)
}
You should get the fixed lib from our github.
Regards,
Slava
Perfect! Thanks I will use that!