Skip to main content
Every option is validated once, when the client is created. An invalid option is rejected with a NexusConfigError naming the option, the reason and the value you passed - including the array index for a schedule entry. Nothing is coerced: a coerced mistake resurfaces days later as unexplained load or a stalled stream, with nothing pointing back at the cause.

Options

Local development

Start the app with westyx dev run and give the SDK neither baseUrl nor apiKey:
westyx dev run starts a local session broker for the lifetime of the dev server and passes its address as WESTYX_DEV_BROKER. The dev server forwards /__westyx to it, and the SDK reads the service endpoint and a Developer WIF session from /__westyx/session on the page’s own origin, sends the session as Authorization: Bearer, and renews it before it expires - re-running westyx dev setup while the app runs is picked up without a restart. The session acts as a public key: configs and flags, never secrets. Only the dev server forwards that path, so a production build never reaches a session; production keeps baseUrl and apiKey. The developer session exists only in a browser: a keyless configuration during server-side rendering is a NexusConfigError. The dev server needs one proxy entry; westyx dev setup recognises the framework and prints the lines, or writes them for Angular. westyx dev setup writes it for you: proxy.conf.mjs at the project root,
and "proxyConfig": "proxy.conf.mjs" in the application’s serve target options in angular.json. It leaves an angular.json with comments, several applications or an existing proxyConfig untouched and prints the lines to add instead. When the session cannot be obtained, NexusInitError carries a NexusDevSessionError that says why - most often that the app was not started with westyx dev run or that the proxy entry is missing. See Error handling.

Endpoint per environment in production

In production the endpoint and the key are passed in code. To vary them per build, use Angular’s environment files: ng generate environments creates src/environments/environment.ts plus a development variant, and fileReplacements in angular.json swaps them per build configuration.
Pass environment.nexusBaseUrl as baseUrl. The SDK reads no variable at run time: a browser has no process environment. Anything a bundler inlines is shipped to every visitor - which is fine here, since the endpoint and the wxp_ key are public by design, but keep secrets out of it.

What gets rejected

The last one carries only the key’s prefix. Key material never appears in an error message or a log record.

The deadlines, and why there are three

A request without a deadline is the failure that wedges a client: a connection a middlebox has stopped answering never settles, and the in-flight guard it holds is never released. requestTimeoutMs bounds that. A live stream needs different treatment, because it is supposed to stay open with nothing arriving. streamConnectTimeoutMs bounds only the connection attempt. streamIdleTimeoutMs is the liveness deadline: it is reset by every byte, keepalive comments included, so a healthy but quiet stream stays open indefinitely while a connection dropped silently by a proxy is detected instead of reading as healthy forever.

Cooldown schedule

After the live stream fails three times in a row, the SDK stops trying it for a while and relies on TTL polling. sseReconnectCooldown is how long it waits before each subsequent attempt, in minutes:
  • undefined - [5, 10, 20, 40, 60]
  • a number, e.g. 10 - a fixed ten-minute interval
  • an array, e.g. [1, 2, 5] - a custom schedule that stays at its last value
Every entry must be a positive finite number.