Flow Control Manager

The Flow Control Manager is not commonly used, since the default values work fine in most situations.

However, if you need to fine-tune the client-side on and off window size for your application, you can do this easily through the service-side API.

You should adjust these settings with caution: the wrong settings could negatively impact the performance of your application.

The classes required to adjust flow control settings are part of the FlowControlManager interface in the StateManager class.

Adjusting Flow Control

To adjust the flow control of your PureWeb application, you use the FlowControlManager interface of the StateManager class.

The methods themselves are fairly self-explanatory. You can get the current size for the on window (getOnWindowSize) and for the off window (getOffWindowSize), and you can set new window size values (setWindowSize).

Below are code snippets illustrating how to use these methods. The default values are 3 for on window size and 5 for off window size; in this example, and we change them to 5 and 7, respectively.


To get the current size for the on/off windows:

int onWindowSize = StateManager::Instance()->FlowControlManager().OnWindowSize();
int offWindowSize = StateManager::Instance()->FlowControlManager().OffWindowSize();

To set new sizes:

StateManager::Instance()->FlowControlManager().SetWindowSize(5, 7);


To get the current size for the on/off windows:

int onWindowSize = StateManager.Instance.FlowControlManager.OnWindowSize;
int offWindowSize = StateManager.Instance.FlowControlManager.OffWindowSize;

To set new sizes:

StateManager.Instance.FlowControlManager.SetWindowSize(5, 7);


To get the current size for the on/off windows:

int onWindowSize = StateManager.getInstance().getFlowControlManager().getOnWindowSize();
int offWindowSize = StateManager.getInstance().getFlowControlManager().getOffWindowSize();

To set new sizes:

StateManager.getInstance().getFlowControlManager().setWindowSize(5, 7);

Although changing the window sizes is relatively simple, knowing which size is appropriate can be more tricky. The only absolute rule is that the value for onWindowSize must always be less than the value for offWindowSize. Another rule of thumb is that you should keep the difference between the two sizes relatively small.

As you experiment with different values, you should use caution: having an onWindowSize too small or an offWindowSize too large would both create performance issues. For example the application could be playing catch up and still process requests after the user has finished interacting, or could run in fits and starts.