Skip to main content

Configuration reference

ESPRMNeoBaseConfig is the single object ESPRMNeoBase.configure() takes, and ESPRMNeoBase is where every process-wide setting lives afterwards. This page is the field-by-field reference; Getting started is the narrative version.

Required fields

FieldContents
baseUrlMain API base, stage included
userApiBaseUser and auth API base, stage included
awsRegionAWS region, such as us-east-1
iotEndpointIoT endpoint host, or a full wss:// URL

baseUrl and userApiBase must parse as URLs; a trailing slash is stripped for you. Include the API Gateway stage when using a default execute-api host; a custom domain usually needs none.

iotEndpoint accepts either a bare host such as <id>-ats.iot.<region>.amazonaws.com or a full wss://…/mqtt URL; both are normalised.

awsRegion is checked for non-emptiness only, not against a list of regions.

Optional adaptor fields

FieldType
customStorageAdapterESPStorageAdapter
provisionAdapterESPProvisionAdapterInterface
mqttAdapterMQTTTransport

Each is validated by method presence when supplied. See Adaptors for the contracts and for why storage is effectively required on React Native.

Lifecycle methods

MethodEffect
configure(config)Validate, dispose previous state, initialise
init(config)Alias for configure
dispose()Reset all state and peer singletons
getConfig()Frozen copy of the active configuration
getAuthInstance()The ESPRMNeoAuth instance
subscriptionManagerThe ESPRMNeoSubscriptionManager

configure() is safe to call again; it disposes first, so re-pointing an app at another deployment works without a restart.

getConfig() returns a frozen shallow copy, so mutating it changes nothing. getConfig(), getAuthInstance() and subscriptionManager all throw ESPConfigError with code SDK_NOT_CONFIGURED before configure() has run.

dispose() clears configuration, adaptors, the auth instance and the subscription manager, and resets the transport order to its default. Use it when tearing down, including between tests.

Adaptor accessors

MethodPurpose
setStorageAdapter(adaptor)Replace storage and re-init persistence
storageAdapterGet or set storage as a property
setProvisioningAdapter(adaptor)Replace the provisioning adaptor
getProvisionAdapter()Read it, or undefined

Every setter requires a configured SDK and rejects a falsy adaptor, throwing the matching ESPConfigError code. Prefer setStorageAdapter() over the property setter; the property setter skips the initialisation check.

There is no setter for the MQTT adaptor. It is read only during configure(), so changing it means configuring again.

Transport order

MethodEffect
setTransportOrder(order)Set the global default
getTransportOrder()Copy of the global default

The default is ["local", "mqtt"]. Nodes copy the global order when constructed, so changing it does not affect nodes you already hold. See Transports.

Both throw ESPConfigError with code INVALID_TRANSPORT_ORDER for an empty array or a non-array.

Fields this SDK does not take

Configuration for this SDK is deliberately small. It has no version or apiPath field (the stage goes in the two base URLs) and no Cognito identifiers, because sign-in and credential exchange run through your deployment's User API rather than against Cognito directly from the app.

Do not port configuration from other Espressif SDKs

identityId, userPoolId, clientId, authUrl and redirectUrl are not fields here. Passing them is silently ignored rather than rejected, since validation checks only the fields it knows, so a config copied from another SDK appears to work until sign-in fails.