Constructor
new RCONConnection(options)
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
options |
Object
|
The initialization options.
|
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:
-
Record.<number, RequestCacheItem>
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.
|
||||||||||||||
options |
Object
|
<optional> |
{ encrypt: true } |
Transmission configuration.
|