GithubHelp home page GithubHelp logo

ag-up-poc's Introduction

#Proof Of Concept: AeroGear Unified Push Server... NOTE: THIS IS NOT YET READY, it's just evaluating some ideas

Some guidance ...

Registration

Register a PushApplication

curl -v -H "Accept: application/json"  \
  -H "Content-type: application/json"  \ 
  -X POST  \ 
  -d '{"description":"just a test", "name":"TestApp"}'\
  http://localhost:8080/applications

The response returns an PUSH-APP-ID....

Add an iOS Mobile Application:

curl -v -H "Accept: application/json"  \
  -H "Content-type: application/json"  \
  -X POST  \
  -d '{"certificate":"/Users/matzew/Desktop/PUSHER.p12", "passphrase":"foo"}'  \
  http://localhost:8080/applications/{PushAppID}/iOS

The response returns an MOBILE-APP-ID....

Note: Use a path - upload not yet supported..................

Add an Android Mobile Application:

curl -v -H "Accept: application/json"  \
  -H "Content-type: application/json"  \
  -X POST  \
  -d '{"google-api-key" : "MY GOOGLE ID"}'  \
  http://localhost:8080/applications/{PushAppID}/android

The response returns an MOBILE-APP-ID....

Registration of an installation, on a device (iOS)

Client-side example for how to register an installation:

- (void)application:(UIApplication*)application
  didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
    NSString *tokenStr = [deviceToken description];
    NSString *pushToken = [[[tokenStr
      stringByReplacingOccurrencesOfString:@"<" withString:@""]
      stringByReplacingOccurrencesOfString:@">" withString:@""]
      stringByReplacingOccurrencesOfString:@" " withString:@""];

  // TODO: use https
    AFHTTPClient *client =
	  [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@"http://192.168.0.114:8080/"]];
    client.parameterEncoding = AFJSONParameterEncoding;

    // set the AG headers....
    [client setDefaultHeader:@"AG-PUSH-APP" 
	   value:@"SOME ID..."];
    [client setDefaultHeader:@"AG-Mobile-APP"
	   value:@"SOME OTHER ID..."];



    [client postPath:@"/registry/device"
	  parameters:@{@"token": pushToken, @"os": @"iOS"}
	  success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSLog(@"\nSUCCESS....\n");
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"%@", error);
    }];
}

No real client SDK, YET!!!!

Sender

Send broadcast push message to ALL mobile apps of a certain Push APP......:

curl -v -H "Accept: application/json"  \
  -H "Content-type: application/json"  \
  -X POST  \
  -d '{"key":"blah", "alert":"Test...."}'  \
  http://localhost:8080/sender/broadcast/{PushAppID}

More details

Concepts and ideas are also being developed...:

See: https://gist.github.com/matzew/69d33a18d4fac9fdedd4

REST APIs

ag-up-poc's People

Contributors

matzew avatar

Watchers

 avatar  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.