Giter Site home page Giter Site logo

sabondano / slacker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from turingschool-examples/slacker

0.0 1.0 0.0 138 KB

A pub/sub chat using Redis

Home Page: https://github.com/turingschool/lesson_plans/blob/master/ruby_04-apis_and_scalability/pubsub_on_the_server.markdown

Ruby 100.00%

slacker's Introduction

Slacker

A pub/sub chat using Redis. Written as a tool for this lesson on server-side pub/sub.

Slacker provides a few simple ruby files for subscribing and publishing to redis channels.

It will look for an environment variable called SLACKER_REDIS when deciding which server to connect to. By default it will use the standard redis url (localhost:6379).

Group Exercise

For the group exercise, provide everyone with a shared,network-accessible redis url. One easy way to obtain a new redis url is to create a new heroku app (heroku create) and add the redistogo addon (heroku addons:create redistogo).

Once this is done, you can retrieve the newly created redis url by checking heroku config.

Once you have this URL, use it for your redis connections by sourcing it into the environment when running each file.

For example

SLACKER_REDIS=my-redis-to-go-url ruby publishers/talker.rb

Provided Scripts

Subscribers

  • subscribers/listener.rb - Subscribes to "community" channel and prints messages to consol
  • subscribers/logger.rb - Subs to "community" and logs messages to log.txt
  • subscribers/whisper.rb - Subs to "community" and forwards messages to a slack integration

Note The whisper.rb slack integration requires a SLACKER_WEBHOOK ENV variable, which needs to contain the ID of the "bean-spiller" slack integration.

This is an incoming webhook in the slack API which accepts messages and posts them to Turing's super-secret slack channel.

Authorized slack users can retrieve the appropriate token from this slack page

Publishers

  • publishers/talker.rb - Simple message input REPL - gives a command prompt and sends any input to "community" redis channel
  • publishers/webber.rb - Sinatra-based web UI for taking messages via a form and posting them to the redis channel

slacker's People

Contributors

stevekinney avatar worace avatar

Watchers

 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.