Code Monkey home page Code Monkey logo

orbital's Introduction

Orbital

Orbital was built as an in-house demo for DISQUS to show a realtime representation of comments as they happen on the network. It was heavily inspired by Mozilla's Glow project, but was mostly rewritten in order to achieve true real-time. It was originally released to the public at PyCon 2012.

It's a simple demonstration of how easy you can achieve something like this with just a little bit of Python and JavaScript code in modern browsers.

The code itself does not contain the firehose-like mechanism DISQUS uses to obtain the data from their API. It does, however, contain a script which allows you to send mock data to demonstrate how to create a publisher.

You can view the current version of orbital on the web at http://map.labs.disqus.com

https://github.com/disqus/orbital/raw/master/example.png

Setup

You can install most requirements via Homebrew and PIP

brew install geoip libevent zeromq
pip install -r requirements.txt

Install Maxmind's GeoIP city data files to /usr/share/GeoIP/

cp GeoIPCity.dat /usr/share/GeoIP/GeoIPCity.dat

Run the server

python server.py

Configure haproxy (or something) to forward websockets on port 80 to port 7000, and setup something to serve site/.

Streaming Data

Two example feeders are included. One explicitly takes your accounts DISQUS data and feeds it in through the production DISQUS API. For example, if you run three forums, it will continually stream data for all comments made on those forums through the server. The other feeder will simply send fake data, and can be used as example code to create your own custom data feeder.

Streaming DISQUS Data

To stream data from DISQUS you'll first need to configure the application. To do this visit the following URL, and register a new application:

https://disqus.com/api/applications/register/

Once you've created the application, make sure the Default Access (under "Settings") is set to "Read, Write, and Manage Forums". You'll need the Manage Forums bit explicitly, as otherwise you wont gain admin access to the forums you moderate, which means DISQUS won't send any private user data (such as IPs).

First you'll want to copy the default configuration file:

cp app.cfg.example app.cfg

Now open this file in your favorite editor and adjust the settings to match your API application. You'll specifically need the values for "Consumer Secret" and "Access Token".

Finally, run the feeder:

python disqus_feeder.py

Note

You'll see a lot of data when you first run it, as it gets the "last 100 posts" to start the stream.

Streaming Example Data

The second stream which is included sends sample data which is useful for modeling and testing your frontend application. No configuration is required for this stream, and you can simply run it:

python dummy_feeder.py

Credits

Map design and original concept from Mozilla's Glow project.

orbital's People

Contributors

dcramer avatar

Stargazers

Arti Villa avatar Jason Beverage avatar Kenny Freeman avatar Andriy Tymchenko avatar david watson avatar

Watchers

 avatar Mark Story avatar Billy Vong avatar Mike Clarke avatar Karl Stenerud avatar Matt Robenolt avatar Chris Clark avatar James Cloos avatar Rickie Sherman avatar Anton Ovchinnikov avatar Filippo Pacifici avatar Jess MacQueen avatar Dan Fuller avatar danzamerlot avatar Ayesha Omarali avatar LB avatar Osmar Coronel avatar  avatar  avatar Dena Mwangi avatar Chloe Condon 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.