Extends
- EventEmitter
Methods
(async) _acquire() → {Promise.<(Session|null)>}
Acquires a session asynchronously, and prepares the transaction for the session.
Once a session is successfully acquired, it returns the session object (which may be null
if unsuccessful).
Returns:
Type | Description |
---|---|
Promise.<(Session|null)> |
A Promise that resolves with the acquired session (or |
_maintain() → {void}
Maintains the multiplexed session by periodically refreshing it.
This method sets up a periodic refresh interval for maintaining the session. The interval duration is determined by the @param refreshRate option, which is provided in days. The default value is 7 days.
Returns:
Type | Description |
---|---|
void |
This method does not return any value. |
Throws:
-
If the multiplexed session creation fails in
_createSession
, the error is caught and ignored. This is because the currently active multiplexed session has a 30-day expiry, providing the maintainer with four opportunities (one every 7 days) to refresh the active session. - Type
- Error
createSession()
Creates a new multiplexed session and manages its maintenance.
This method initiates the session creation process by calling the _createSession
method, which returns a Promise.
getSession(callback) → {void}
Retrieves a session asynchronously and invokes a callback with the session details.
Parameters:
Name | Type | Description |
---|---|---|
callback |
GetSessionCallback |
The callback to be invoked once the session is acquired or an error occurs. |
Returns:
Type | Description |
---|---|
void |
This method does not return any value, as it operates asynchronously and relies on the callback. |