Sites

Menu
These are the docs for 13.8, an old version of SpatialOS. The docs for this version are frozen: we do not correct, update or republish them. 14.0 is the newest →

Configuring a client-worker

This file specifies the configuration parameters of a client-worker.

Configuration file

The file may be called by any name but should have the following structure:

{
  "workerType": "...",
  "layer": "...",  
  "entityInterest": {
    "rangeEntityInterest": {
      "radius": 2
    }
  },
  "streamingQuery": [
    ...
  ],
  "componentDelivery": {
    "default": "RELIABLE_ORDERED",
    "checkoutAllInitially": true
  },
  "componentSettings": {
    ...
  },
  "permissions": {
    "entity_creation": {
        "allow": true
    },
    "entity_deletion": {
        "allow": true
    },
    "entity_query": {
        "allow": true
    }
  },
  "loginRateLimit": {
    "duration": "1h20m30s",
    "requestsPerDuration": 100 
  },
  "connectionCapacityLimit": {
    "maxCapacity": 1000
  },
  "uploadConfiguration": {
    ...
  }
}
Field Required/Optional Description
workerType Required Used to identify this worker type in your project. A workerType must be unique project-wide. The workerType specified in this field must also match the workerType that your worker instance reports in its ConnectionParameters when connecting to a deployment. For more information, see the API reference.
layer Required The name of the simulation layer of this worker type, used to determine the load balancing strategy. For more information, see the layers documentation.
entityInterest Optional Specifies the entities to subscribe to in addition to the ones the worker is has write access authority over. The semantics are analogous to the entity_interest field in the previous configuration version.
streamingQuery Optional Specifies the streaming queries the bridge will subscribe to. Analogous to streaming_query in the previous configuration version.
componentDelivery Optional Specifies the delivery settings for the worker’s components. Analogous to component_delivery in the previous configuration version.
componentSettings Optional Defines component specific settings. Analogous to component_settings in the previous configuration version.
permissions Optional Specifies the worker’s entity permissions. Analogous to permissions in the previous configuration version, with the difference that the permissions property here is a single permission object rather than an array.
loginRateLimit Optional Defines an upper limit for the frequency at which worker instances of this worker type are allowed to connect to a single deployment. It contains two fields:
- duration: time window of the login rate limit to be specified as a string in the form of <x>h<y>m<z>s, e.g. 1h30s
- requestsPerDuration: Maximum number of worker instances that is allowed to connect during the given duration

For more information, see Worker connection limits.
connectionCapacityLimit Optional Defines an upper limit for how many worker instances of this worker type may be simultaneously connected to a single deplyoment. It has a single field (maxCapacity) for specifying the maximum number of connected worker instances.

For more information, see Worker connection limits.
uploadConfiguration Optional Describes how to upload the worker. If provided, the spatial alpha cloud upload CLI command uploads the built-out client-worker executable, enabling you to use it with the Launcher. See below for more information.

Upload configuration

The upload configuration specifies the directory that contains the client-worker binary to be used with the Launcher. You need it to upload a client-worker using the CLI. Below is an example excerpt:

      "windows": {
        "localBuildDirectory": "bin/x64/ReleaseWindows"
      },
      "macos": {
        "localBuildDirectory": "bin/x64/ReleaseMacOS"
      }

There must be a configuration for each platform the worker will be run on. The platform name can be one of windows or macos. Each of these can have the following fields:

Field Required/Optional Description
localBuildDirectory Required The directory containing the client-worker binary. Your built-out worker must be self-contained in the localBuildDirectory and all files that your worker might depend on while running must be in this folder. Files outside this folder will not be uploaded to the cloud as part of your project assembly.

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums