Server text as typed, e.g. nats1.oats:8080. A missing
scheme is filled in from the page protocol, and the other scheme is tried next.
OptionalcredentialsContent: stringContents of a .creds file, not a path. Omit to
connect without credentials.
The connected service, or null if the server text is blank, the
credentials authenticator cannot be built, or no candidate URL connects.
Connects to central NATS over WebSocket and creates a KV manager.
Tries each URL from
buildServerCandidatesin order and returns the first connection that succeeds. TLS is turned off explicitly forws:URLs. Every failure is logged to the console, and the function resolves tonullinstead of rejecting.The KV manager's JetStream client skips the JetStream account check (
checkAPI: false), which would otherwise cost one extra round trip each time a bucket is opened. An account without JetStream then fails on the first KV request instead of on open.