Skip to content

probe-web / @probe-web/client / index / openSession

Function: openSession()

ts
function openSession(opts): Promise<{
  client: Client;
  session: Session;
  probe: DebugProbeEntry;
}>;

Defined in: index.ts:564

Connect over either transport, pick a probe and attach: the same few lines every app and check page needs. On WebUSB the probe must already be granted to the page (requestProbe).

Fails with kind: 'probe-not-found' when no probe matches; the client is closed on any failure.

Parameters

ParameterType
optsOpenSessionOptions

Returns

Promise<{ client: Client; session: Session; probe: DebugProbeEntry; }>

Example

ts
const { client, session, probe } = await openSession({ transport: 'webusb', probe: 'MCU-Link', chip: 'MCXA153' });
console.log(`attached via ${probe.identifier}`);
// … use `session` …
client.close();