Retrieves the session mode for a given client session in a swarm.
This function returns the current mode of the specified client session, which can be one of "session", "makeConnection", or "complete".
It validates the client session and associated swarm, logs the operation if enabled, and fetches the session mode using the session validation service.
The execution is wrapped in beginContext to ensure it runs outside of existing method and execution contexts, providing a clean execution environment.
Parameters
clientId: string
The unique identifier of the client session whose mode is being retrieved.
Returns Promise<SessionMode>
A promise that resolves to the session mode, indicating the current state of the session.
Throws
If the client session is invalid, the swarm validation fails, or the session validation service encounters an error during mode retrieval.
Example
constmode = awaitgetSessionMode("client-123"); console.log(mode); // Outputs "session", "makeConnection", or "complete"
Retrieves the session mode for a given client session in a swarm.
This function returns the current mode of the specified client session, which can be one of
"session"
,"makeConnection"
, or"complete"
. It validates the client session and associated swarm, logs the operation if enabled, and fetches the session mode using the session validation service. The execution is wrapped inbeginContext
to ensure it runs outside of existing method and execution contexts, providing a clean execution environment.