Skip to main content

Response

Sent by the framework to confirm that a worker has successfully registered and is ready to communicate. This message is typically sent after the worker establishes a WebSocket connection.
string
required
Message type. Must be "workerregistered".
string
required
Unique identifier assigned to this worker by the framework.

Examples

Basic Worker Registration Confirmation

UUID-Based Worker ID

Connection Flow

Typical sequence when a worker connects:

Handling Registration

Store Worker ID

Registration with Retry

Registration Event Handler

Error Cases

Registration Timeout

If a WorkerRegistered message is not received within a reasonable timeout (typically 10-30 seconds):
  • The connection may have failed during handshake
  • The framework may be unresponsive or overloaded
  • Network issues may be preventing communication
  • Consider closing the connection and retrying

Connection Closed Before Registration

If the WebSocket connection closes before receiving WorkerRegistered:
  • The framework may have rejected the connection
  • Authentication or authorization may have failed
  • The framework may be shutting down
  • Check framework logs for rejection reasons

Notes

  • WorkerRegistered is typically the first message received after connecting
  • The worker should not send registration messages (RegisterService, RegisterFunction, etc.) until receiving WorkerRegistered
  • The worker_id can be used for logging, monitoring, and debugging
  • The worker_id format is determined by the framework implementation
  • Store the worker_id for the duration of the connection
  • On reconnection, a new worker_id will typically be assigned
  • The worker must re-register all services, functions, and triggers after receiving a new WorkerRegistered message

Best Practices

  • Wait for confirmation: Don’t send other messages until WorkerRegistered is received
  • Implement timeout: Set a timeout for registration and reconnect if not received
  • Log the worker ID: Include worker_id in all logs for traceability
  • Handle reconnection: Re-register everything when a new worker_id is assigned
  • Emit events: Notify your application code when registration completes
  • Store state: Track registration status to prevent sending messages prematurely