<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Yeah, this is meant to be more of an abstract spec as opposed to actual usage. What your suggesting is more of an implementation detail and is similar to what I have in my head. How I have imagined this is where you started going with "clients" which maintain a number of channels. That is definitely where I would be headed with this in my head along the same lines as a Pipeline (Notifier) has pipes (some name like clients).<div><br><div><div>On Feb 21, 2013, at 2:00 PM, Sebastien Blanc &lt;<a href="mailto:scm.blanc@gmail.com">scm.blanc@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">That looks great !&nbsp;<div>Maybe one suggestion, like the PipeManager holds Pipe objecst and the DataStore hold Store objects, maybe the Notifier could hold Channels ?&nbsp;</div><div><br></div><div><br></div><div><pre class="line-pre" style="word-wrap:break-word;width:744px;margin-top:0px;margin-bottom:0px;padding:0px;background-color:rgb(255,255,255)"><div class="line" id="file-gistfile1-js-LC1"><font face="Consolas, Liberation Mono, Courier, monospace"><span style="font-size:12px;line-height:16px">var myChannel = AeroGear.Notifier.addChannel(String channel);
myChannel.onMessage(data);
myChannel.publishMessage(data);</span></font></div><div class="line" id="file-gistfile1-js-LC1"><font face="Consolas, Liberation Mono, Courier, monospace"><span style="font-size:12px;line-height:16px"><br></span></font></div>
<div class="line" id="file-gistfile1-js-LC1"><font face="Consolas, Liberation Mono, Courier, monospace"><span style="font-size:12px;line-height:16px">And maybe pushing the concept further, the notifier could hold "clients" which holds channels ... </span></font></div>
<div class="line" id="file-gistfile1-js-LC1"><font face="Consolas, Liberation Mono, Courier, monospace"><span style="font-size:12px;line-height:16px"><br></span></font></div></pre><br><div class="gmail_quote">On Thu, Feb 21, 2013 at 6:38 PM, Matthias Wessendorf <span dir="ltr">&lt;<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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 style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;padding:0px;border:0px"><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 style="color:rgb(153,153,136);font-style:italic">/**</span>
<span 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 style="color:rgb(153,153,136);font-style:italic"> * object will be passed to the callback</span>
<span style="color:rgb(153,153,136);font-style:italic"> */</span>
<span>AeroGear</span><span>.</span><span>Notifier</span><span>.</span><span>connect</span><span>(</span><span style="color:rgb(0,134,179)">String</span> <span>url</span><span>,</span> <span style="font-weight:bold">function</span> <span>callback</span><span>);</span>

<span style="color:rgb(153,153,136);font-style:italic">/**</span>
<span 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 style="color:rgb(153,153,136);font-style:italic"> * Error object will be passed to the callback</span>
<span style="color:rgb(153,153,136);font-style:italic"> */</span>
<span>AeroGear</span><span>.</span><span>Notifier</span><span>.</span><span>disconnect</span><span>(</span><span style="font-weight:bold">function</span> <span>callback</span><span>);</span>

<span style="color:rgb(153,153,136);font-style:italic">/**</span>
<span 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 style="color:rgb(153,153,136);font-style:italic"> */</span>
<span>AeroGear</span><span>.</span><span>Notifier</span><span>.</span><span>subscribe</span><span>(</span><span style="color:rgb(0,134,179)">String</span> <span>channel</span><span>,</span> <span style="font-weight:bold">function</span> <span>callback</span><span>);</span>

<span style="color:rgb(153,153,136);font-style:italic">/**</span>
<span style="color:rgb(153,153,136);font-style:italic"> * Removes the subscription of the given channel.</span>
<span style="color:rgb(153,153,136);font-style:italic"> */</span>
<span>AeroGear</span><span>.</span><span>Notifier</span><span>.</span><span>unsubscribe</span><span>(</span><span style="color:rgb(0,134,179)">String</span> <span>channel</span><span>);</span>

<span style="color:rgb(153,153,136);font-style:italic">/**</span>
<span style="color:rgb(153,153,136);font-style:italic"> * Publishes a message to a given channel</span>
<span style="color:rgb(153,153,136);font-style:italic"> */</span>
<span>AeroGear</span><span>.</span><span>Notifier</span><span>.</span><span>publish</span><span>(</span><span style="color:rgb(0,134,179)">String</span> <span>channel</span><span>,</span> <span style="color:rgb(0,134,179)">Object</span> <span>message</span><span>);</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&nbsp;<em>STATE-MASHINE</em>&nbsp;would be nice as well:</p><div style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;padding:0px;border:0px">

<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>AeroGear</span><span>.</span><span>Notifier</span><span>.</span><span>CONNECTING</span> <span style="font-weight:bold">=</span> <span style="color:rgb(0,153,153)">0</span><span>;</span>
<span>AeroGear</span><span>.</span><span>Notifier</span><span>.</span><span>OPEN</span> <span style="font-weight:bold">=</span> <span style="color:rgb(0,153,153)">1</span><span>;</span>
<span>AeroGear</span><span>.</span><span>Notifier</span><span>.</span><span>CLOSING</span> <span style="font-weight:bold">=</span> <span style="color:rgb(0,153,153)">2</span><span>;</span>
<span>AeroGear</span><span>.</span><span>Notifier</span><span>.</span><span>CLOSED</span> <span style="font-weight:bold">=</span> <span style="color:rgb(0,153,153)">3</span><span>;</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="13cfdd5a0e71af03_implementation-of-the-adapters" 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" target="_blank"></a>Implementation of the Adapters</h2><div 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>...</div><div 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></div><div 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></div><div 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 ?</div><span class="HOEnZb"><font color="#888888"><div 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></div><div 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></div><div 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></div><br>-- <br>Matthias Wessendorf<br><br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>

twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a><br>
</font></span><br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br></blockquote></div><br></div>
_______________________________________________<br>aerogear-dev mailing list<br><a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/aerogear-dev</blockquote></div><br></div></body></html>