<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">So, in theory, would I be able to<br>
<br>
1) Define a message channel (boats)<br>
2) Define a series of systems which implement that channel
(websocket, GCM, carrier pigeon)<br>
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)<br>
<br>
?<br>
<br>
Summers<br>
<br>
<br>
On 02/21/2013 12:38 PM, Matthias Wessendorf wrote:<br>
</div>
<blockquote
cite="mid:CAAg5f2ROzZNMv4ZAZrvp9OVqALL9-t=VbWJH9m23vUcV7iu1Hg@mail.gmail.com"
type="cite">
<p
style="margin-right:0px;margin-bottom:15px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px;margin-top:0px!important">Hello!</p>
<p style="margin:15px
0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px">Today,
I had a brief chat with Kris about a potential AeroGear <em>Notifier</em> Client
API...</p>
<p style="margin:15px
0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px">The
basic idea is to <em>wrap</em> messaging APIs (e.g. Stomp.js,
Vertx's eventbus or Socket.io/Engine.io) behind a common client
'interface'.</p>
<p style="margin:15px
0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px">Basically
the AeroGear-Notifier should be able to <em>connect</em> to a
messaging system in order to <em>subscribe</em> to a channel to
reveice messages from that channel. The AG-Notifier is also able
to <em>publish</em> messages to ANY channel. Of course,<em>unsubscribe</em> and <em>disconnect</em> are
required too...</p>
<p style="margin:15px
0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px">Sure...
the above is not (YET) really a <em>SPEC</em>, but it's
start.... the JS API of the AG-Notifier (DRAFT 0.0.1) could
looks like this:</p>
<div class="highlight"
style="background-color:rgb(255,255,255);border:0px;padding:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px">
<pre style="font-size:13px;line-height:19px;font-family:Consolas,'Liberation Mono',Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px"><span class="cm" style="color:rgb(153,153,136);font-style:italic">/**</span>
<span class="cm" style="color:rgb(153,153,136);font-style:italic"> * Connects to a given URL. The callback is invoked after a connection has been established. In case of an error, an Error</span>
<span class="cm" style="color:rgb(153,153,136);font-style:italic"> * object will be passed to the callback</span>
<span class="cm" style="color:rgb(153,153,136);font-style:italic"> */</span>
<span class="nx">AeroGear</span><span class="p">.</span><span class="nx">Notifier</span><span class="p">.</span><span class="nx">connect</span><span class="p">(</span><span class="nb" style="color:rgb(0,134,179)">String</span> <span class="nx">url</span><span class="p">,</span> <span class="kd" style="font-weight:bold">function</span> <span class="nx">callback</span><span class="p">);</span>
<span class="cm" style="color:rgb(153,153,136);font-style:italic">/**</span>
<span class="cm" style="color:rgb(153,153,136);font-style:italic"> * Tears down the connection. The callback is invoked after a connection has been closed. In case of an error, an</span>
<span class="cm" style="color:rgb(153,153,136);font-style:italic"> * Error object will be passed to the callback</span>
<span class="cm" style="color:rgb(153,153,136);font-style:italic"> */</span>
<span class="nx">AeroGear</span><span class="p">.</span><span class="nx">Notifier</span><span class="p">.</span><span class="nx">disconnect</span><span class="p">(</span><span class="kd" style="font-weight:bold">function</span> <span class="nx">callback</span><span class="p">);</span>
<span class="cm" style="color:rgb(153,153,136);font-style:italic">/**</span>
<span class="cm" style="color:rgb(153,153,136);font-style:italic"> * Subscribes to a channel. The callback function is invoked for every message, received on the given channel.</span>
<span class="cm" style="color:rgb(153,153,136);font-style:italic"> */</span>
<span class="nx">AeroGear</span><span class="p">.</span><span class="nx">Notifier</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="nb" style="color:rgb(0,134,179)">String</span> <span class="nx">channel</span><span class="p">,</span> <span class="kd" style="font-weight:bold">function</span> <span class="nx">callback</span><span class="p">);</span>
<span class="cm" style="color:rgb(153,153,136);font-style:italic">/**</span>
<span class="cm" style="color:rgb(153,153,136);font-style:italic"> * Removes the subscription of the given channel.</span>
<span class="cm" style="color:rgb(153,153,136);font-style:italic"> */</span>
<span class="nx">AeroGear</span><span class="p">.</span><span class="nx">Notifier</span><span class="p">.</span><span class="nx">unsubscribe</span><span class="p">(</span><span class="nb" style="color:rgb(0,134,179)">String</span> <span class="nx">channel</span><span class="p">);</span>
<span class="cm" style="color:rgb(153,153,136);font-style:italic">/**</span>
<span class="cm" style="color:rgb(153,153,136);font-style:italic"> * Publishes a message to a given channel</span>
<span class="cm" style="color:rgb(153,153,136);font-style:italic"> */</span>
<span class="nx">AeroGear</span><span class="p">.</span><span class="nx">Notifier</span><span class="p">.</span><span class="nx">publish</span><span class="p">(</span><span class="nb" style="color:rgb(0,134,179)">String</span> <span class="nx">channel</span><span class="p">,</span> <span class="nb" style="color:rgb(0,134,179)">Object</span> <span class="nx">message</span><span class="p">);</span>
</pre>
</div>
<p style="margin:15px
0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px">Perhaps
a <em>STATE-MASHINE</em> would be nice as well:</p>
<div class="highlight"
style="background-color:rgb(255,255,255);border:0px;padding:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px">
<pre style="font-size:13px;line-height:19px;font-family:Consolas,'Liberation Mono',Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px"><span class="nx">AeroGear</span><span class="p">.</span><span class="nx">Notifier</span><span class="p">.</span><span class="nx">CONNECTING</span> <span class="o" style="font-weight:bold">=</span> <span class="mi" style="color:rgb(0,153,153)">0</span><span class="p">;</span>
<span class="nx">AeroGear</span><span class="p">.</span><span class="nx">Notifier</span><span class="p">.</span><span class="nx">OPEN</span> <span class="o" style="font-weight:bold">=</span> <span class="mi" style="color:rgb(0,153,153)">1</span><span class="p">;</span>
<span class="nx">AeroGear</span><span class="p">.</span><span class="nx">Notifier</span><span class="p">.</span><span class="nx">CLOSING</span> <span class="o" style="font-weight:bold">=</span> <span class="mi" style="color:rgb(0,153,153)">2</span><span class="p">;</span>
<span class="nx">AeroGear</span><span class="p">.</span><span class="nx">Notifier</span><span class="p">.</span><span class="nx">CLOSED</span> <span class="o" style="font-weight:bold">=</span> <span class="mi" style="color:rgb(0,153,153)">3</span><span class="p">;</span>
</pre>
</div>
<h2 style="margin:20px 0px
10px;padding:0px;font-size:24px;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(204,204,204);font-family:Helvetica,arial,freesans,clean,sans-serif"><a
moz-do-not-send="true" name="implementation-of-the-adapters"
class="anchor"
href="https://gist.github.com/matzew/bd4f3c41e1114c225eb1#implementation-of-the-adapters"
style="color:rgb(65,131,196);text-decoration:initial;display:block;padding-left:30px"></a>Implementation
of the Adapters</h2>
<p
style="margin-top:0px;margin-right:0px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px;margin-bottom:0px!important">The
different adapter implementations will be done separately: <code
style="font-size:12px;line-height:normal;font-family:Consolas,'Liberation
Mono',Courier,monospace;margin:0px 2px;padding:0px
5px;border:1px solid
rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">ag-notifier-vertx.js</code>...</p>
<p
style="margin-top:0px;margin-right:0px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px;margin-bottom:0px!important"><br>
</p>
<p
style="margin-top:0px;margin-right:0px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px;margin-bottom:0px!important"><br>
</p>
<p
style="margin-top:0px;margin-right:0px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px;margin-bottom:0px!important">Thoughts
?</p>
<p
style="margin-top:0px;margin-right:0px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px;margin-bottom:0px!important"><br>
</p>
<p
style="margin-top:0px;margin-right:0px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px;margin-bottom:0px!important"><br>
</p>
<p
style="margin-top:0px;margin-right:0px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px;margin-bottom:0px!important"><br>
</p>
<br>
-- <br>
Matthias Wessendorf<br>
<br>
blog: <a moz-do-not-send="true"
href="http://matthiaswessendorf.wordpress.com/">http://matthiaswessendorf.wordpress.com/</a><br>
sessions: <a moz-do-not-send="true"
href="http://www.slideshare.net/mwessendorf">http://www.slideshare.net/mwessendorf</a><br>
twitter: <a moz-do-not-send="true"
href="http://twitter.com/mwessendorf">http://twitter.com/mwessendorf</a><br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
aerogear-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/aerogear-dev">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a></pre>
</blockquote>
<br>
</body>
</html>