Skip to content

@my-swu/simulator-client


@my-swu/simulator-client / createSimulatorClient

Function: createSimulatorClient() ​

createSimulatorClient(options): SimulatorClient

Defined in: packages/ts-sdk/src/client.ts:173

Creates one typed simulator client.

Use one client per simulator server origin. Payloads are returned as typed values without being checked at runtime; pass validate to have request bodies, responses and socket frames verified against the generated schemas.

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// Resource calls share the base URL configured above.
const health = await simulatorClient.system.health()

Parameters ​

options ​

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// Resource calls share the base URL configured above.
const health = await simulatorClient.system.health()

SimulatorClientOptions

Returns ​

SimulatorClient

Example ​

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

See ​

https://simulator-sdk.my-swu.com/guide/http-client

Released under the MIT License.