useSession

useSession

The effective providers, and this call’s identity.

import { useSession } from "curb";

function useSession(): SessionView;

Returns

ValueWhat it is
settingsThe effective providers
call.sessionIdThe host’s id for this call. On a LiveKit worker, the room name; in curb dev, the preview conversation’s id
call.scratchDirA writable directory of this call’s own, removed when the call ends. Not set in curb dev

call is set on every route that runs a call, and absent under curb say and curb test. Read a call’s identity here, never from process.env: a runner that serves several calls has one environment for all of them.

Example

function CallInfo() {
  const { call } = useSession();
  return <Text>{call ? `Call ${call.sessionId}.` : "Not on a call."}</Text>;
}

Version history

VersionChanges
v1.2.6useSession introduced