Callback

Use to easily communicate between both client and server

Shared - These functions can be used server and client however take note of the direction of callbacks and regration. Client & Server are able to callback between however you are unable to callback between clients.

lib.callback.await

the playerId is only present on the server side, it is not required for the client side.

Call and await for a response of a server callback

-- Client
lib.callback.await(event, ...)
-- Server
lib.callback.await(event, playerId, ...)
Parameter TypeRequiredDescription

event

String

Server defined event name

playerId

Number

Server Only - source to send request to

cb

Function

Callback function, there must be at least one defined

lib.callback.register

Register a client callback, this can be used to easily request data from a client from the server

lib.callback.register(event, cb)
Parameter TypeRequiredDescription

event

String

Event name to be called from the server

cb

Function

Callback function, should return values for the callback

Last updated