GithubHelp home page GithubHelp logo

miguelramosfdz / pub-sub-map Goto Github PK

View Code? Open in Web Editor NEW

This project forked from anders94/pub-sub-map

0.0 2.0 0.0 1.38 MB

Publish and subscribe to markers on a Google Map with real-time updating.

License: MIT License

JavaScript 27.39% Java 19.57% CSS 35.33% HTML 17.71%

pub-sub-map's Introduction

pub-sub-map

Publish and subscribe to markers on a Google Map with real-time updating. A large number of web viewers can watch the realtime locations of sets of markers.

This is the new engine behind http://eyezo.com/ currently in development.

Demo: pub-sub-map

Requires

  • node
  • redis

Setup

cd pub-sub-map/
npm install

Add your Google Maps API key on line 89 of views/layout.jade where it says "YOUR_API_KEY". [Generate your Google Maps Key] (https://developers.google.com/maps/documentation/javascript/tutorial#api_key)

Quick Start

Start the app:

node app

Navigate to:

http://localhost:8070/

(automatically subscribes to 'ISS', the International Space Station)

In another shell, start sending some points for the International Space Station: (requires java)

cd pub-sub-map/generators/iss/
java com/anders/ISSPosition

Click 'ISS' under 'Center On' in the web UI. You should see the approximate ground track of the ISS pushed to the browser in realtime.

Now, in another shell, start sending some random points for a new location. Let's call it 'joe':

cd pub-sub-map/generators/
node send joe

Subscribe to 'joe' in the web UI. You should see a marker drop in around some place in Cambridge, MA and randomly start moving in a northeast direction. Select 'joe' under 'Center On' if you don't see him. You might also want to zoom the map in a little bit because he doesn't move very quickly.

Notice how 'joe' leaves a different color trail than the ISS? Add a few more things to track and you should see other colors as well. (eventually they will recycle) Open up a few more web browsers and notice how many viewers can follow the same or different sets of tracks. Cool, eh?

The server keeps track of each browser's subscriptions and pushes the points to each browser. No polling here! Subscriptions are limited to 10, tunable within app.js. Currently pub-sub-map is tested and working on desktop, iOS and Android (WebKit) clients.

Future work involves making the payload more efficient (multiple subscriptions in one json package) and prepopulating the last 25 known good points on subscription initiation.

That's it for now, enjoy!

Follow me on Twitter: @anders94

pub-sub-map's People

Contributors

alanpsih avatar anders94 avatar mappingkat avatar

Watchers

 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.