RCONConnection

RCONConnection

Represents a single RCON server connection.

Constructor

new RCONConnection(options)

Parameters:
Name Type Description
options Object The initialization options.
Name Type Description
client RCONClient The parent RCON client instance.

Extends

  • EventEmitter

Members

authToken :string|null

Type:
  • string | null

host :string

Type:
  • string

maxMessagesInAir :number

Maximum allowed concurrent requests to prevent server throttling.
Type:
  • number

messageQueue :Array.<function()>

Queue of pending send operations waiting for capacity.
Type:
  • Array.<function()>

messagesInAir :number

Type:
  • number

password :string

Type:
  • string

port :number

Type:
  • number

receiveBuffer :Buffer

Continuous buffer to hold incoming TCP data until full messages are formed.
Type:
  • Buffer

requestCache :Record.<number, RequestCacheItem>

Key-value map of active messages waiting for response.
Type:

socket :net.Socket

Type:
  • net.Socket

transmitMessageIndex :number

Auto-increment for every sent message to assign a unique ID for each request.
Type:
  • number

xorKey :Buffer|null

Type:
  • Buffer | null

Methods

disconnect()

Closes the socket.

(async) send(message, optionsopt) → {Promise.<ResponseMessage>}

Constructs and sends a RequestMessage to the RCON server. Enqueues the request if the maximum concurrent limit has been reached.
Parameters:
Name Type Attributes Default Description
message Object The message payload.
Name Type Attributes Description
name string The command or action name.
contentBody Object | string <optional>
The body content of the message.
options Object <optional>
{ encrypt: true } Transmission configuration.
Name Type Attributes Default Description
encrypt boolean <optional>
true Whether to send the buffer encrypted.
Returns:
Type:
Promise.<ResponseMessage>
The resolved response from the server.