But, as said on the first email, there is no spec right now...

BUT..., yes - that's the idea behind the _abstract_ notifier API.

On Fri, Feb 22, 2013 at 6:56 PM, Matthias Wessendorf <matzew@apache.org> wrote:


On Fri, Feb 22, 2013 at 6:53 PM, Summers Pittman <supittma@redhat.com> wrote:
So, in theory, would I be able to

1) Define a message channel (boats)

a 'pipe' :) to a server, yes. Publishing from client works. and receicing msgs on that channel works too 
 
2) Define a series of systems which implement that channel (websocket, GCM, carrier pigeon)

this is just 'js' client api... so... there will be only SockJS (websocket and legacy fallbacks). No GCM/APNs receiving in JS land (pure mobile web).
 
3) Have AG Auto negotiate systems. (When the app is up use a websocket system, when it background use GCM, and when the network is down scan QR codes off pigeons)

I guess anwser to 2) makes sense here ?
 

?

Summers



On 02/21/2013 12:38 PM, Matthias Wessendorf wrote:

Hello!

Today, I had a brief chat with Kris about a potential AeroGear Notifier Client API...

The basic idea is to wrap messaging APIs (e.g. Stomp.js, Vertx's eventbus or Socket.io/Engine.io) behind a common client 'interface'.

Basically the AeroGear-Notifier should be able to connect to a messaging system in order to subscribe to a channel to reveice messages from that channel. The AG-Notifier is also able to publish messages to ANY channel. Of course,unsubscribe and disconnect are required too...

Sure... the above is not (YET) really a SPEC, but it's start.... the JS API of the AG-Notifier (DRAFT 0.0.1) could looks like this:

/**
 * Connects to a given URL. The callback is invoked after a connection has been established. In case of an error, an Error
 * object will be passed to the callback
 */
AeroGear.Notifier.connect(String url, function callback);

/**
 * Tears down the connection. The callback is invoked after a connection has been closed. In case of an error, an
 * Error object will be passed to the callback
 */
AeroGear.Notifier.disconnect(function callback);

/**
 * Subscribes to a channel. The callback function is invoked for every message, received on the given channel.
 */
AeroGear.Notifier.subscribe(String channel, function callback);

/**
 * Removes the subscription of the given channel.
 */
AeroGear.Notifier.unsubscribe(String channel);

/**
 * Publishes a message to a given channel
 */
AeroGear.Notifier.publish(String channel, Object message);

Perhaps a STATE-MASHINE would be nice as well:

AeroGear.Notifier.CONNECTING = 0;
AeroGear.Notifier.OPEN = 1;
AeroGear.Notifier.CLOSING = 2;
AeroGear.Notifier.CLOSED = 3;

Implementation of the Adapters

The different adapter implementations will be done separately: ag-notifier-vertx.js...



Thoughts ?





--
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf


_______________________________________________
aerogear-dev mailing list
aerogear-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev


_______________________________________________
aerogear-dev mailing list
aerogear-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev



--
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf