Skip to content


Fine network traffic control

Request processing policies

Braze allows the user the option to control network traffic using the following protocols:

Automatic request processing

ABKRequestProcessingPolicy enum value: ABKAutomaticRequestProcessing

  • This is the default request policy value.
  • The Braze SDK will automatically handle all server communication, including:
    • Flushing custom events and attributes data to Braze servers
    • Updating Content Cards and Geofences
    • Requesting new in-app messages
  • Immediate server requests are performed when user-facing data is required for Braze features, such as in-app messages.
  • To minimize server load, Braze performs periodic flushes of new user data every few seconds.

Data can be manually flushed to Braze servers at any time using the following method:

1
[[Appboy sharedInstance] flushDataAndProcessRequestQueue];
1
Appboy.sharedInstance()?.flushDataAndProcessRequestQueue()

Manual request processing

ABKRequestProcessingPolicy enum value: ABKManualRequestProcessing

  • This protocol is the same as automatic request processing except:
    • Custom attributes and custom event data are not automatically flushed to the server throughout the user session.
  • Braze will still perform automatic network requests for internal features, such as requesting in-app messages, Liquid templating in in-app messages, Geofences, and location tracking. For more details, see the ABKRequestProcessingPolicy declaration in Appboy.h. When these internal requests are made, locally stored custom attributes and custom event data may be flushed to the Braze server, depending on the request type.

Data can be manually flushed to Braze servers at any time using the following method:

1
[[Appboy sharedInstance] flushDataAndProcessRequestQueue];
1
Appboy.sharedInstance()?.flushDataAndProcessRequestQueue()

Setting the request processing policy

Set request policy on startup

These policies can be set at app startup time from the startWithApiKey:inApplication:withLaunchOptions:withAppboyOptions method. In the appboyOptions dictionary, set the ABKRequestProcessingPolicyOptionKey as shown in the following code snippet:

1
2
3
4
NSDictionary *appboyOptions = @{
  // Other entries
  ABKRequestProcessingPolicyOptionKey : @(ABKAutomaticRequestProcessing)
};
1
2
3
4
let appboyOptions: [AnyHashable: Any] = [
  // Other entries
  ABKRequestProcessingPolicyOptionKey: ABKRequestProcessingPolicy.automaticRequestProcessing.rawValue
]

Set request policy at runtime

The request processing policy can also be set during runtime via the requestProcessingPolicy property on Appboy:

1
2
// Sets the request processing policy to automatic (the default value)
[Appboy sharedInstance].requestProcessingPolicy = ABKAutomaticRequestProcessing;
1
2
// Sets the request processing policy to automatic (the default value)
Appboy.sharedInstance()?.requestProcessingPolicy = ABKRequestProcessingPolicy.automaticRequestProcessing

Manual shutdown of in-flight server communication

If at any time an “in-flight” server communication needs to be halted, you must call the following method:

1
[[Appboy sharedInstance] shutdownServerCommunication];
1
Appboy.sharedInstance()?.shutdownServerCommunication();

After calling this method, you must reset the request processing mode to automatic. For this reason, we only recommend calling this if the OS is forcing you to stop background tasks or something similar.

HOW HELPFUL WAS THIS PAGE?
New Stuff!