Socket
Book a DemoInstallSign in
Socket

squad-rcon

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

squad-rcon

This library is designed for the game Squad, it will give you the ability to easily connect to Rcon and parse/execute commands. I hope it will be useful to you!

1.1.8
latest
Source
npmnpm
Version published
Weekly downloads
27
8%
Maintainers
1
Weekly downloads
 
Created
Source

SquadRcon

This library is designed for the game Squad, it will give you the ability to easily connect to Rcon and parse/execute commands. I hope it will be useful to you!

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js.

If this is a brand new project, make sure to create a package.json first with the npm init command.

Installation is done using the

$ npm install squad-rcon

or

$ yarn add squad-rcon

Quick Start

import { Rcon } from 'squad-rcon';

(async () => {
  try {
    const rcon = new Rcon({
      id: 1,
      host: '127.0.0.1',
      port: 1111,
      password: 'qwerty',
    });

    await rcon.init();

    rcon.on('ListPlayers', (data) => {
      console.log(data);
    });

    rcon.execute('ListPlayers');
  } catch (e: unknown) {
    console.log(e);
  }
})();

API

Initialization

import { Rcon } from 'squad-rcon';

Rcon({
  id: 1,
  host: '127.0.0.1',
  port: 1111,
  password: 'qwerty',
  pingDelay: 60000, // optional
  autoReconnect: true, // optional
  autoReconnectDelay: 60000, // optional
  logEnabled: true, // optional
  chatListeners: {
    onChatMessage: (data: TChatMessage) => null, // optional
    onPlayerWarned: (data: TPlayerWarned) => null, // optional
    onPlayerKicked: (data: TPlayerKicked) => null, // optional
    onPlayerBanned: (data: TPlayerBanned) => null, // optional
    onSquadCreated: (data: TSquadCreated) => null, // optional
    onPossessedAdminCamera: (data: TPossessedAdminCamera) => null, // optional
    onUnPossessedAdminCamera: (data: TUnPossessedAdminCamera) => null, // optional
  }, // optional
});

Rcon return some pre-defined functions:

Functions

FunctionReturnTypeEmitter
initPromisePromise
closePromisePromise
rconEmitterEmitterEventEmitteron()
executePromisePromise<string>on('data')
getListPlayersPromiseTPlayer[]on('ListPlayers')
getListSquadsPromiseTSquad[]on('ListSquads')
getCurrentMapPromiseTMapon('ShowCurrentMap')
getNextSquadsPromiseTMapon('ShowNextMap')

Events Emitter

EventReturnType
ListPlayersresponseTPlayer[]
ListSquadsresponseTSquad[]
ShowCurrentMapresponseTMap
ShowNextMapresponseTMap
CHAT_MESSAGEresponseTChatMessage
POSSESSED_ADMIN_CAMERAresponseTPossessedAdminCamera
UNPOSSESSED_ADMIN_CAMERAresponseTUnPossessedAdminCamera
PLAYER_WARNEDresponseTPlayerWarned
PLAYER_KICKEDresponseTPlayerKicked
SQUAD_CREATEDresponseTSquadCreated
PLAYER_BANNEDresponseTPlayerBanned
dataresponseTRconResponse
errerrorError
connected
close

FAQs

Package last updated on 02 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.