Worker Class

Namespace: Improbable.Gdk.Core
GDK package: Core

Represents a SpatialOS worker.




WorkerType Source
readonly string WorkerType

The type of the worker.
WorkerId Source
readonly string WorkerId

The worker ID.

  • Unique for a given SpatialOS deployment.
Attributes Source
readonly List<string> Attributes

The worker attribute list
LogDispatcher Source
ILogDispatcher LogDispatcher

The logger for this worker.
IsConnected Source
bool IsConnected

Denotes whether this worker is connected or not.
ConnectionHandler Source
IConnectionHandler ConnectionHandler

Static Methods

CreateWorkerAsync Source
async Task<Worker> CreateWorkerAsync(IConnectionHandlerBuilder connectionHandlerBuilder, string workerType, ILogDispatcher logDispatcher, CancellationToken? token = null)

Creates a Worker object asynchronously.

A task which represents the asynchronous creation of a worker.

  • IConnectionHandlerBuilder connectionHandlerBuilder : A builder which describes how to create the IConnectionHandler for this worker.
  • string workerType : The type of worker to connect as.
  • ILogDispatcher logDispatcher : The logger to use for this worker.
  • CancellationToken? token : A cancellation token which will cancel this asynchronous operation


Worker Source
Worker(IConnectionHandler connectionHandler, string workerType, ILogDispatcher logDispatcher)



Tick Source
void Tick()

Ticks the worker. Fetches all messages received since the last Tick call and applies the diff.
EnsureMessagesFlushed Source
void EnsureMessagesFlushed()

SendLogMessage Source
void SendLogMessage(LogLevel logLevel, string message, string loggerName, EntityId? entityId)

Sends a log message to SpatialOS from this worker.

  • LogLevel logLevel : The log verbosity level.
  • string message : The log message.
  • string loggerName : A name for the sender of the log.
  • EntityId? entityId : The EntityId to associate with the log message. Set to null for no EntityId.
GetWorkerFlag Source
string GetWorkerFlag(string key)

Gets the value for a given worker flag.

The value of the flag, if it exists, null otherwise.

  • string key : The key of the worker flag.
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