sendSingleton


General

sendSingleton sends a singleton service request to every server connected to the token with the same name. Only the first sent singleton within a minute will be received by the event.


Usage

Client:sendSingleton(<string> singletonName, (ANY) data)
Returns: <boolean> success

The callback can be specified with setSingletonEvent.

It is a shared service - it will run on every server connected to the token which is assigned the same singleton name.


Limitations

See action POST.


Example

Client:setSingletonEvent(5, "hello", function(singleton, date)
	print(singleton, date)
end)

print("1st received:", Client:sendSingleton("hello", "Is anyone there?"))
wait(5)
print("2nd received:", Client:sendSingleton("hello", "HELLO! PLEASE ANSWER"))
wait(90)
print("3rd received:", Client:sendSingleton("hello", "ANSWER ASAP"))

Back to top