Skip to main content
Version: 4.6.1-saas

Code-based Integration - Section Control

A feature that controls to maintain the number of concurrent users in a specific section of the application at a constant value. When the start function is called, a key is issued, and until the stop function is called, the user is considered to be in an active section, so the next waiting user is not allowed to enter. When the stop function is called, the key is returned and the next waiting user can enter.

Integration Method

Section control is one of two control types available in code-based integration. To compare with basic control and choose the most suitable approach for your use case, refer to the Integration Methods Overview.

Detailed Explanation

For detailed information about how section control works, optimal use cases, use cases, etc., refer to the "Code-based Integration - Section Control" section in the Common Guide document.


Start Function

Function Name: nfStartSection

Description: Call the function at the point where you want to apply waiting to issue a key and display the waiting room.

Parameters:

ParameterTypeDescription
projectKeyStringSection control project key from console
segmentKeyStringSection control segment key from console
callbackNetfunnelCallbackCustom callback function for waiting room event handling
contextBuildContextBuildContext of the screen where the waiting room is applied

Example:

import 'package:netfunnel_flutter/netfunnel_flutter.dart';
import 'package:flutter/material.dart';

class NetfunnelHandler extends NetfunnelCallback {
@override
void onSuccess(int statusCode, String message) {
// Logic to handle when queue is passed
}

@override
void onError(int statusCode, String message) {
// Logic to handle when error occurs
}

@override
void onNetworkError(int statusCode, String message) {
// Logic to handle when network error occurs
}

@override
void onBlock(int statusCode, String message) {
// Logic to handle when user entry is blocked
}

@override
void onClose(int statusCode, String message) {
// Logic to handle when user cancels waiting
}
}

void handleSectionStart(BuildContext context) {
Netfunnel.instance.nfStartSection(
projectKey: '{{PROJECT_KEY}}',
segmentKey: '{{SEGMENT_KEY}}',
callback: NetfunnelHandler(),
context: context,
);
}
Callback Function Implementation

For how to implement callback functions, refer to the Callback Functions section.


Stop Function

Function Name: nfStopSection

Description: Used to return the key after entry is completed.

If the stop function is not executed, the user is considered to remain in the active section, and the next waiting user's entry may be delayed.

Parameters:

ParameterTypeDescription
projectKeyStringSection control project key from console
segmentKeyStringSection control segment key from console

Example:

Netfunnel.instance.nfStopSection(
projectKey: '{{PROJECT_KEY}}',
segmentKey: '{{SEGMENT_KEY}}',
);