Giter Site home page Giter Site logo

hackchat-server's Introduction

NPM version NPM downloads travis build Dependency Status Codecov Language grade: JS/TS MIT License semantic-release Patreon

Table of contents

About

hackchat-server is a general use websocket server module designed to quickly bootstrap an application. The protocol is json only, with a module-based RPC-style command structure.

  • Hot reload support
    • Update code without losing current connections
  • Built in ratelimiting & ip ban
  • Simple statistics tracking
  • Self documenting *
  • Session recovery *
  • Multi-language support
  • Quick module boilerplate generation
    • npx hc-generate-cmd

Installation

Node.js (version 14.0) or newer is required.

Add to your project with npm install hackchat-server --save.

Once installed, run npx hc-config to generate a config file. Skip this step if you are using an existing config file.

Next, you may choose to run npx hc-import and import the standard modules. You should, at minimum, import the internal/* modules, unless you're working with existing command module files. The hc-import script will accept a --remote argument to import remote command modules, like npx hc-import --remote=https://github.com/someUser/command-modules.git. (Note: currently this feature is unavailable)

Or use npx hc-generate-cmd to quickly generate boilerplate modules.

All hc-config, hc-import & hc-generate-cmd scripts support multiple languages via the --lang argument. See example values in languages section. Example: hc-generate-cmd --lang=fr

Example usage

import { CoreApp } from 'hackchat-server';

const server = new CoreApp({
  configPath: '.hcserver.json',
  logErrDetailed: true,
  lang: 'en',
});

server.init();

Standard Modules

  1. internal\disconnect.js CLient disconnection event handler
  2. internal\socketreply.js Client error/warn event handler
  3. remote\session.js Standard remote session handler
  4. utility\help.js Self documentation module
  5. utility\reload.js Command hot reloader module

Links

Languages

Currently supported:

Contributing

Languages:

After forking & cloning this repo, navigate to the src/translations directory. Duplicate the en.json file. What you name the duplicate json file is fairly important, highly suggest that you use the two-letter ISO 639-1 abbreviations. The new language file will then be used by the lang property passed to the server, or by the --lang argument on the npx scripts.

Issues:

Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the documentation.

hackchat-server's People

Contributors

marzavec 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.