All Projects β†’ yatki β†’ flood-protection

yatki / flood-protection

Licence: MIT license
Flood protection for realtime applications

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to flood-protection

Beaver
πŸ’¨ A real time messaging system to build a scalable in-app notifications, multiplayer games, chat apps in web and mobile apps.
Stars: ✭ 1,056 (+5457.89%)
Mutual labels:  socket-io, realtime
Aaronvandenberg.nl
βš›οΈ Web Developers portfolio build with Gatsby.js & React.js
Stars: ✭ 98 (+415.79%)
Mutual labels:  socket-io, realtime
Vynchronize
Watch videos with friends online with the new real time video synchronization platform
Stars: ✭ 1,072 (+5542.11%)
Mutual labels:  socket-io, realtime
Realtime Newsapi
Financial News Aggregator - Real Time & Query API for Financial News
Stars: ✭ 34 (+78.95%)
Mutual labels:  socket-io, realtime
Rtcode
Real time code sharing web application
Stars: ✭ 170 (+794.74%)
Mutual labels:  socket-io, realtime
Express Security
nodejs + express security and performance boilerplate.
Stars: ✭ 37 (+94.74%)
Mutual labels:  socket-io, rate-limiting
Simple Realtime Message Socketio Nodejs Ci
πŸ”Œ Simple realtime push message using Socket.IO (Node.JS) integrated with PHP (CodeIgniter) and database MySQL
Stars: ✭ 85 (+347.37%)
Mutual labels:  socket-io, realtime
realtime-private-chat-nodejs-socketio-vuejs-laravel
Realtime Private Chat NodeJS SocketIO Vue JS Laravel
Stars: ✭ 72 (+278.95%)
Mutual labels:  socket-io, realtime
Phpsocket.io
A server side alternative implementation of socket.io in PHP based on workerman.
Stars: ✭ 2,026 (+10563.16%)
Mutual labels:  socket-io, realtime
Codenames
Stars: ✭ 159 (+736.84%)
Mutual labels:  socket-io, realtime
Laravel Video Chat
Laravel Video Chat using Socket.IO and WebRTC
Stars: ✭ 646 (+3300%)
Mutual labels:  socket-io, realtime
bitrix-antispam
1C Bitrix anti-spam mod.
Stars: ✭ 10 (-47.37%)
Mutual labels:  anti-spam, spam-protection
Vue Socket.io Extended
✌️⚑️ Socket.io bindings for Vue.js and Vuex (inspired by Vue-Socket.io)
Stars: ✭ 506 (+2563.16%)
Mutual labels:  socket-io, realtime
Progress Bot
High-tech weaponized moe progress delivery bot for IRC, Discord, and web
Stars: ✭ 38 (+100%)
Mutual labels:  socket-io, realtime
Social Network
Mini social network that I made as my first web app project.
Stars: ✭ 458 (+2310.53%)
Mutual labels:  socket-io, realtime
Realtime Rails
Realtime rails support. See website for documentation:
Stars: ✭ 77 (+305.26%)
Mutual labels:  socket-io, realtime
syncwatch
Browser extension to watch videos together
Stars: ✭ 48 (+152.63%)
Mutual labels:  socket-io, realtime
spacebro
Spacebro makes communication between apps effortless
Stars: ✭ 13 (-31.58%)
Mutual labels:  socket-io, realtime
Rltm.js
Easily swap realtime providers with a single code base
Stars: ✭ 106 (+457.89%)
Mutual labels:  socket-io, realtime
Radar
Arduino Servo controller with Ultrasonic sensor, that will send distance value from sensor to Node.js via USB serial and leveraging socket.io to send the data to browser in realtime.
Stars: ✭ 24 (+26.32%)
Mutual labels:  socket-io, realtime

flood-protection

Flood protection for realtime applications

NPM version Build Status Coverage Status

Why?

Purpose of this library is to have control on receiving data packages. It allows you to drop data packages (e.g. messages) if they arrive too quickly. As an example you may want to use it to prevent spam messages in chat rooms or to limit number of requests to your http/express server.

Notes:

Install

npm install --save flood-protection

Usage

import FloodProtection from 'flood-protection';

const floodProtection = new FloodProtection({
    rate: 5, 
    // default: 5, unit: messages
    // IMPORTANT: rate must be >= 1 (greater than or equal to 1)
    
    per: 8, 
    // default: 8, unit: seconds
  });

Basic Example

import FloodProtection from 'flood-protection';

// ...
// io is a Socket.io instance...

io.on('connection', (client) => {
  client.emit('connected');

  const floodProtection = new FloodProtection();
 
  client.on('message', (text) => {
    if (floodProtection.check()) {
      // forward message
      io.emit('message', text);     
    } else {
      // forbid message
      client.emit('flood', {
        text: 'Take it easy!',
      });
    }
  });
});

Contribution

As always, I'm open to any contribution and would like to hear your feedback.

Just an important reminder:

If you are planning to contribute to any open source project, before starting development, please always open an issue and make a proposal first. This will save you from working on features that are eventually going to be rejected for some reason.

LICENCE

MIT (c) 2017 Mehmet YatkΔ±

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].