meetups - a realtime distributed monitoring application (android)

12
Meetups Realtime multi-agent monitoring

Upload: aditya-gupta

Post on 07-Aug-2015

66 views

Category:

Software


2 download

TRANSCRIPT

Meetups Realtime multi-agent monitoring

Overview

• Meetup

• Feature list

• Architecture

• Heartbeats

• Pointers / Key Challenges

• Work Distribution

2

Meetup

What

Live Android App

Realtime multi-agent monitoring

Why

Help people ‘Meetup’

And get around safely3

Feature List

• Notifications

• Pair-up / Pooling Suggestions

• Automatic Activation / Deactivationprivacy

• Automatic Contact Syncing

• Modern UI Design

• Navigate to past locations of other users

• Low Bandwidth Usagepayloads

4

Backend Architecture https://github.com/ca9/meetup-backend

• Google Cloud Endpoints (Backend)

• Free. Easy deployment. Documented. Google Support.

• Logs, Traces, Version Management.

• Python API Server

• Stateless BaaS

• NDB Datastore

5

Backend Pointers

• Security

• OAuth2 Authentication (took 2 months to get right), Google library changes. Google API token management.

• POST encapsulation, SHA1 identification

• Documented Client library generation, with code completion

• UTC timezones

• Checking for duplication. Object deletion.

• Stateless (No GCM dependency). No ‘session’.

6

Backend Architecture Snaps7

Frontend Architecturehttps://github.com/vedantswain/Meetup-Android

• Integration

• Interaction with backend server via client libraries

• Simplified development of client side and maintained consistency in responses and requests

• Security

• Credentials create user and data api instances for (secure) communication with the server

• One-time-login: Saved state of authenticated state on client’s SharedPreferences

8

Frontend Contd.• Time

• Default timezones on Mobile Devices

• DateTime object sent to server asepoch (independent of timezone)

• Server stores time in UTC

• Ensures consistency between the clients (irrespective of timezone) and with the server

• Exclusive Functions for Meetup Owner

• Certain functions (activate, deactivate) can only be executed by the owner of the metope

• Prevents anarchic behaviour

9

Frontend Structure

Frontend Contd.• Single Service

• Optimisation: Single background service that sends periodic heartbeats for a given user to all the meetups

• Local Database

• Locations of users for different meetups at different times are stored in the a local db

• Avoids fetching bulk data from server; simply handles light weight latest locations

• Visualisation

• Plots path of every user on the map

• Heartbeat locations are nodes

• Colour coordinated paths to ease interpretation

10

public static abstract class LocationEntry implements BaseColumns { public static final String TABLE_NAME = "Location"; public static final String TIME = "Time"; public static final String LATITUDE = "Latitude"; public static final String LONGITUDE="Longitude"; public static final String USERNAME="User_Name"; public static final String MEETUPNAME="Meetup_Name";

public static final String SQL_CREATE_ENTRIES = "CREATE TABLE " + LocationEntry.TABLE_NAME + " (" + LocationEntry._ID + " INTEGER PRIMARY KEY," + LocationEntry.TIME + REAL_TYPE + COMMA_SEP + LocationEntry.LATITUDE + REAL_TYPE + COMMA_SEP + LocationEntry.LONGITUDE + REAL_TYPE + COMMA_SEP + LocationEntry.USERNAME + TEXT_TYPE + COMMA_SEP + LocationEntry.MEETUPNAME +TEXT_TYPE + " )"; public static final String SQL_DELETE_ENTRIES = "DROP TABLE IF EXISTS " + LocationEntry.TABLE_NAME;

}

SQLite Local DB

Heartbeats

• Lightweight, high frequency messages

• Can be dropped / Can fail

• Trigger all important app functionality

• Status Responses

• Gotta give to get some love.

• Life: Update last location and timestamp of user under meetup. Check for proximity to destination, other users. Auto deactivate meetups, return other’s latest heartbeats.

11

Work Distribution

• Backend - https://github.com/ca9/meetup-backend

• Frontend - https://github.com/vedantswain/Meetup-Android

12