Get SpatialOS

Sites

Menu

WorkerConnector Class

Namespace: Improbable.Gdk.Core
GDK package: Core
Source

Connect workers via Monobehaviours.

Inheritance

MonoBehaviour IDisposable


Fields

MaxConnectionAttempts Source
int MaxConnectionAttempts

The number of connection attempts before giving up.
Worker Source
Worker Worker

Represents a SpatialOS worker.

Notes:
  • Only safe to access after the connection has succeeded.


Properties

OnWorkerCreationFinished Source
Action<Worker> OnWorkerCreationFinished { }

An event that triggers when the worker has been fully created.


Static Methods

CreateNewWorkerId Source
string CreateNewWorkerId(string workerType)

Parameters
  • string workerType :


Methods

OnApplicationQuit Source
void OnApplicationQuit()

OnDestroy Source
void OnDestroy()

GetConnectionService Source
abstract ConnectionService GetConnectionService()

Determines which ConnectionService to use to connect to the SpatialOS Runtime.

Returns:
A ConnectionService object describing which connection servce to use.
GetConnectionParameters Source
abstract ConnectionParameters GetConnectionParameters(string workerType, ConnectionService service)

Retrieves the ConnectionParameters needed to be able to connect to any connection service.

Returns:
A ConnectionParameters object.

Parameters
  • string workerType : The type of worker you want to connect.
  • ConnectionService service : The connection service used to connect.
GetLocatorConfig Source
abstract LocatorConfig GetLocatorConfig()

Retrieves the configuration needed to connect via the Locator service.

Returns:
A LocatorConfig object.
GetAlphaLocatorConfig Source
abstract AlphaLocatorConfig GetAlphaLocatorConfig(string workerType)

Retrieves the configuration needed to connect via the Alpha Locator service.

Returns:
A AlphaLocatorConfig object.

Parameters
  • string workerType :

Notes:
  • This connection service is still in Alpha and does not provide an integration with Steam.
GetAlphaLocatorConfigViaDevAuthFlow Source
AlphaLocatorConfig GetAlphaLocatorConfigViaDevAuthFlow(string workerType)

Retrieves the configuration needed to connect via the Alpha Locator service using the development authentication flow.

Returns:
A AlphaLocatorConfig object.

Parameters
  • string workerType :
GetReceptionistConfig Source
abstract ReceptionistConfig GetReceptionistConfig(string workerType)

Retrieves the configuration needed to connect via the Receptionist service.

Returns:
A ReceptionistConfig object.

Parameters
  • string workerType : The type of worker you want to connect.
GetPlayerId Source
string GetPlayerId()

Retrieves the player id for the player trying to connect via the anonymous authentication flow.

Returns:
A string containing the player id.
GetDisplayName Source
string GetDisplayName()

Retrieves the display name for the player trying to connect via the anonymous authentication flow.

Returns:
A string containing the display name.
SelectDeploymentName Source
string SelectDeploymentName(DeploymentList deployments)

Selects which deployment to connect to.

Returns:
The name of the deployment to connect to.

Parameters
  • DeploymentList deployments : The list of deployments.
GetDevAuthToken Source
string GetDevAuthToken()

Loads the development authentication token and stores it in the DevelopmentAuthToken field.
SelectLoginToken Source
string SelectLoginToken(List<LoginTokenDetails> loginTokens)

Selects which login token to use to connect via the anonymous authentication flow.

Returns:
The selected login token.

Parameters
  • List<LoginTokenDetails> loginTokens : A list of available login tokens.
GetDevelopmentPlayerIdentityToken Source
string GetDevelopmentPlayerIdentityToken(string authToken, string playerId, string displayName)

Retrieves the player identity token needed to generate a login token when using the anonymous authentication flow.

Returns:
The player identity token.

Parameters
  • string authToken : The authentication token that you generated.
  • string playerId : The id of the player that wants to connect.
  • string displayName : The display name of the player that wants to connect.
GetDevelopmentLoginTokens Source
List<LoginTokenDetails> GetDevelopmentLoginTokens(string workerType, string playerIdentityToken)

Retrieves the login tokens for all active deployments that the player can connect to via the anonymous authentication flow.

Returns:
A list of all available login tokens and their deployments.

Parameters
  • string workerType : The type of the worker that wants to connect.
  • string playerIdentityToken : The player identity token of the player that wants to connect.
HandleWorkerConnectionEstablished Source
void HandleWorkerConnectionEstablished()

HandleWorkerConnectionFailure Source
void HandleWorkerConnectionFailure(string errorMessage)

Parameters
  • string errorMessage :
Connect Source
async Task Connect(string workerType, ILogDispatcher logger)

Asynchronously connects a worker to the SpatialOS runtime.

Parameters
  • string workerType : The type of the worker to connect as
  • ILogDispatcher logger : The logger for the worker to use.

Notes:
  • Uses the global position of this GameObject as the worker origin. Uses ShouldUseLocator to determine whether to connect via the Locator.
Dispose Source
void Dispose()

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums