localhost
region.
You can configure multiple regions and let the SDK automatically select the best one based on latency.
Configuration
Configure multiple regions in your SDK setup:simulateLatencyCheckMs
property simulates network latency during development (NODE_ENV === 'development'
)
to help test region selection behavior. It only affects latency checks, not actual commands or queries.
Using World Forge? Check out the World Forge guide for
predefined region configurations.
Using React? You can skip everyhing below and head to React
integration for a complete example.
Initialization and Auto-Selection
Initialize the region manager to perform latency checks and automatically select the best region:initialize()
method:
- Performs latency checks against all configured regions
- Automatically selects the region with the lowest latency
- Returns an unsubscribe function for cleanup