Client
???
Constructor
client = Client(url, name, client, updateStateAutomatically)
Arguments
Name | Type | Description |
---|---|---|
url | string | … |
name | string | … |
client | Client | The AlloNet client. |
updateStateAutomatically | boolean | Whether or not the client should automatically update its state. |
Returns
Nothing
Methods
client:getEntity (function)
Fetch an entity when it is received This is asynchronous because you might receive an interaction with an entity ID pointing to an entity that you haven’t received yet.
Arguments
Name | Type | Description |
---|---|---|
function | cb | (entity) callback when entity is arrived |
Returns
Nothing
client:launchApp (string, Pose, table, function)
Ask the place to launch an app found at appurl
.
Arguments
| Name | Type | Description | | ——– | —— | ————— | | string | appurl | The alloapp:
URL to launch into the connected place | | Pose | pose | Transform/position of where in the place to launch the app | | table | args | key-value table of additional arguments to send to the app | | function | cb | Callback for how the launch went. On error, called as cb(false, errstr)
. On success, called as cb(true, launchedAvatarId)
. |
Returns
Nothing
client:sendInteraction (Interaction, Function)
Send an RPC message (aka “interaction”) to another entity.
If you’re sending a “request” interaction (default), you should really listen to the callback to make sure your call succeeded.
Arguments
Name | Type | Description |
---|---|---|
Interaction | interaction | a populated Interaction struct |
Function | callback | (interaction, body) a callback that takes the response interaction and the parsed response body. |
Returns
Nothing
client:poll (timeout_ms)
Send and receive buffered data synchronously now. Loops over all queued network messages until the queue is empty.
Arguments
Name | Type | Description |
---|---|---|
timeout_ms | ??? | how many ms to wait for incoming messages before giving up. Default 10. |
Returns
Type | Description |
---|---|
bool whether any messages were parsed |