Giter VIP home page Giter VIP logo

network-broadcast-news's Introduction

Network Broadcast News

A NodeJS broadcast server for the largest media conglomerate in the world

slides

https://slides.com/devleague/events-and-emitters

https://slides.com/devleague/streams-in-node

Goals

server.js

Use the net module to create a new server that listens on a specified address 0.0.0.0 and port 6969 and listens for and accepts socket connections.

Manage which sockets are connected, and maintain your sockets so that it removes any sockets that disconnect from your server.

Each connected socket is a Duplex stream, when it emits a 'data' event, broadcast the data to all sockets.

client.js

Create a new net.Socket and connect to your running socket server.

Once connected, pipe your terminal's standard input stream to write to your connected socket.

Whenever the connected socket (client) emits a 'data' event, then data is being broadcasted from the server, pipe that data out to your terminal's standard output stream.

example

example

Additional Features

  1. add username registration
    once connected, the new client will be prompted to enter a username, store the username and then allow them to broadcast messages with all messages prepended with their username.
  2. add admin broadcast
    the admin (server.js) can broadcast messages and each message will be prepended with [ADMIN]
  3. prevent users to set their name as [ADMIN] or any other user's name
  4. [bonus] admin can enter a command to kick a client \kick username and kick ip:port will both disconnect the client
  5. [bonus] add a rate limiter that if a client reaches the allowed 'writes per second' limet, automatically kick that user.
  6. [bonus] write a client that floods another server, perhaps with a command \flood "message"

NBN Someone is Always Watching

network-broadcast-news's People

Contributors

jesse-copeland avatar theremix avatar

Watchers

James Cloos avatar May Chen 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.