title: Observable from callback, where callback is not error-first
body: <p>Say I have this:</p>
  
  <pre><code>const register = function(cb){
  
     process.on('message', m =&gt; {
  
           cb(m, (err, v) =&gt; {
  
              process.send({error: err, value: v});
  
           });
     });
  
  };
  </code></pre>
  
  <p>we use the above like:</p>
  
  <pre><code>register((m, cb) =&gt; {
  
     // do something with m
  
     setTimeout(() =&gt; {
        cb('some error', m);
     }, 100);
  
  });
  </code></pre>
  
  <p>my question is - is there a way to use <code>Rx.Observable</code> with this - most examples of <code>Rx.Observable.fromCallback</code> will wrap an <em>error-first</em> callback. But in this case, the callback is not error first. As an exercise, how to make it work for non-error first callbacks? Here is a start:</p>
  
  <pre><code>const {Observable, bindNodeCallback} = require('rxjs');
  
  const obs = bindNodeCallback(register);
  
  const subscription = obs().subscribe(v =&gt; {
  
  }, e =&gt; {
         // this gets hit since the first arg is not an error
   });
  </code></pre>
  
  <p>anyone dealt with this one before?</p>
  
  <p><strong>Update</strong>, I got a little closer, the following example uses setInterval instead of process.on('message') so it is easier to work with for testing:</p>
  
  <p><a href="https://gist.github.com/ORESoftware/ea5d754d6ca6c92ca7e3bddc7eb318c2" rel="nofollow noreferrer">https://gist.github.com/ORESoftware/ea5d754d6ca6c92ca7e3bddc7eb318c2</a></p>