0.1.5 • Published 3 years ago

@etrapia/amqp-rcon-relay v0.1.5

Weekly downloads
-
License
AGPL-3.0-only
Repository
github
Last release
3 years ago

amqp-rcon-relay

Relay server to transform messages sent via AMQP into RCON commands.

License Version Open issues OSS Lifecycle

Key FeaturesInstallationUsageContributingCredits

Key Features

  • Consume AMQP queues and transform messages into RCON commands.
  • Extremely lightweight and flexible (get started in minutes)!
  • Type definitions out of the box!

Installation

Simply add the library as a NPM dependency to your Node.js project.

$ npm i @etrapia/amqp-rcon-relay

You can always use Yarn if that's your kinda jam!

$ yarn add @etrapia/amqp-rcon-relay

Usage

import  RelayServer from '@etrapia/amqp-rcon-relay';

const relay = new RelayServer(
  { // AMQP settings
    uri: 'amqp://localhost',
  }, 
  { // RCON settings
    host: 'localhost',
    port: 25575,
    password: 'abc123',
  },
);

relay.register(
  {
    exchange: {
      name: 'chat',
      type: 'fanout',
      options: {
        durable: false,
      },
    },
    queue: {
      name: '',
      options: {
        exclusive: true,
      },
    },
    transformer(msg) {
      return `say ${msg.getContent()}`;
    },
  },
);

(async () => {
  await relay.listen();
})();

In the above example, any messages sent through the chat exchange will be relayed to the RCON server running on localhost:25575, with the message's content passed as the argument of the /say command.

Contributing

General Guidelines

By contributing to this project, you agree to the general guidelines outlined in the CONTRIBUTING.md file.

Code of Conduct

We have a code of conduct outlined in the CODE_OF_CONDUCT.md file which you are expected to adhere to at all times.

Credits

This project uses the following open source packages:

For a comprehensive list, see the package.json file's dependencies section.