dnode over http with remotes from both ends

147 Views Asked by At

Can anyone think of why two way dnode wouldn't work when using it over HTTP ?

Here is a working TCP example

https://github.com/jpillora/hnode/blob/master/example/dnode-server.js

https://github.com/jpillora/hnode/blob/master/example/dnode-client.js

See the commented section at the bottom for HTTPS attempt (also tried HTTP)

Edit: Since its one way at the moment (client -> server), I could just pass the server the clients remote, though I'm interested to know what's different as I'd thought as long as you had a readable and a writable stream, dnode would work...

1

There are 1 best solutions below

0
On

Figured it out, here's the trick, instead of:

var req = https.request(options, function(res) {
  res.pipe(d).pipe(req);
});

do:

var req = https.request(options, function(res) {
  res.pipe(d);
});
d.pipe(req);

I was missing the first few data events