PoolManager

PoolManager

Manages a pool of RCON connections to distribute the message load.

Constructor

new PoolManager(options)

Parameters:
Name Type Description
options Object The configuration options for the pool manager.
Name Type Attributes Default Description
client RCONClient The parent RCON client instance.
connectionsCount number <optional>
2 The number of connections to maintain in the pool.

Members

client :RCONClient

Type:

connections :Array.<RCONConnection>

Type:

connectionsCount :number

Type:
  • number

isDestroyed :boolean

Type:
  • boolean

Methods

disconnect()

Shuts down all active connections and prevents future reconnections.

(async) init() → {Promise.<void>}

Initializes the connection pool by creating the specified number of connections.
Returns:
Type:
Promise.<void>

(async) send(options) → {Promise.<ResponseMessage>}

Sends an RCON message using the optimal connection from the pool.
Parameters:
Name Type Description
options Object The message payload.
Name Type Attributes Description
name string <optional>
Optional name of the command.
contentBody Object <optional>
The main content of the message.
Throws:
Throws if there are no available connections in the pool.
Type
Error
Returns:
Type:
Promise.<ResponseMessage>
The response from the RCON server.