<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Nice!&nbsp;<br><br>-- qmx (mobile)</div><div><br>On 21/02/2013, at 14:38, Matthias Wessendorf &lt;<a href="mailto:matzew@apache.org">matzew@apache.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><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&nbsp;<em>Notifier</em>&nbsp;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&nbsp;<em>wrap</em>&nbsp;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&nbsp;<em>connect</em>&nbsp;to a messaging system in order to&nbsp;<em>subscribe</em>&nbsp;to a channel to reveice messages from that channel. The AG-Notifier is also able to&nbsp;<em>publish</em>&nbsp;messages to ANY channel. Of course,<em>unsubscribe</em>&nbsp;and&nbsp;<em>disconnect</em>&nbsp;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&nbsp;<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></div></blockquote><span style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); ">this remembers me of event emitter from nodejs - familiar idioms #ftw</span><br><blockquote type="cite"><div><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px">Perhaps a&nbsp;<em>STATE-MASHINE</em>&nbsp;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 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></h2></div></blockquote>nitpicking - connect/disconnect vs open/close<br><blockquote type="cite"><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">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:&nbsp;<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></div></blockquote>+9001 :)&nbsp;<div><br><div><blockquote type="cite"><div><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 href="http://matthiaswessendorf.wordpress.com/">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf">http://www.slideshare.net/mwessendorf</a><br>
twitter: <a href="http://twitter.com/mwessendorf">http://twitter.com/mwessendorf</a><br>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>aerogear-dev mailing list</span><br><span><a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a></span><br><span><a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a></span></div></blockquote></div></div></body></html>