Giter Club home page Giter Club logo

rateway's Introduction

rateway

A stateful gateway for Discord Bots, especially with Travitia in mind.

Scaling well, it processes messages from the Discord gateway and puts them in AMQP exchanges.

Why yet another one?

I am aware that there are projects like spectacles which try to solve this easily. rateway tries to solve a lot of the issues we had when trying to move an existing bot codebase to a seperate gateway.

  • rateway is highly multi-threaded (parallelism) and concurrent (asynchronous)
  • rateway is written in Rust and therefore safe, performant and well-optimized
  • rateway keeps events grouped per cluster, where each gateway cluster should equal one worker on your client side. This allows for not worrying about your REACTION_ADD events arriving on a different worker while you're paginating a help menu
  • rateway keeps a shared cache, so you don't have to. Querying it can be done via AMQP

Docker Image

Can be found here.

Documentation

Please check the user guide on specifics how to implement a client for rateway.

Configuration

Configuration is preferably done in enviroment variables, alternatively, a config file can be passed with rateway /path/to/rateway.toml.

Enviroment Variables

DISCORD_TOKEN (required): Bot Token

INTENTS (required): Intents value (from here)

AMQP_URI (required): AMQP URI to push events to

SHARDS_PER_CLUSTER (optional, defaults to 8): Shards per cluster

EXTRA_SHARDS (optional, defaults to 8): Extra shards to spawn for reserve

CACHE_ENABLED (optional, defaults to true): Toggle caching in rateway

Configuration File

token = "token"
intents = 19553
amqp = "amqp://guest:guest@localhost"
cache_enabled = true

[shards]
per_cluster = 8
extra = 8

Scalability and Performance

rateway utilizes simd-json and zlib-ng for extremely fast gateway parsing. It supports gateway intents and queues connections over the gateway and its HTTP calls properly, making it practically impossible to hit ratelimits.

rateway puts shards into clusters and spawns a new task for each. Tasks are accelerated in threads across all CPU cores based on their load, using the work-stealing concept. This makes it highly efficient and very scalable, across high and low core count CPUs alike.

rateway's People

Contributors

gelbpunkt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.