setSectorFunction


General

setSectorFunction setups a service, which lets you bind a function to a sector (sector can be an unique server or similiar) to return a singleton result.


Usage

Client:setSectorFunction(<number> interval, <string> sectorName, (string) functionName, <function> callback, <boolean> returnEnabled)
Returns: <Connection> sectorConnection

The callback function should use these arguments:
<string> functionName, <ANY> data

The function is called by the sendSector.

It is a singleton function. It won't run on all the server - just a single one to avoid function event fired multiple times.


Limitations

See getSector for retreiving limitations.

Returning data:

Upgrade Type Limit ( per 1s )
STANDARD (0) 15
PREMIUM (1) 30
ELITE (2) 30

The returning data limits are shared with other action services.


Example

Client:setSectorFunction(5, "TrainingGame", "GetData", function(data)
	return {
		success = false;
		message = "Method not setupped yet";
		userId = data.userId;
	}
end, true)

-- CALLING

print(game.HttpService:JSONEncode(
	Client:sendSector("TrainingGame", "GetData", {userId = 21735007}):getResult()
))

Back to top