有人能想到为什么在HTTP上使用双向dnode时不能工作吗?
下面是一个可用的TCP示例
https://github.com/jpillora/hnode/blob/master/example/dnode-server.js
https://github.com/jpillora/hnode/blob/master/example/dnode-client.js
有关HTTPS尝试(也尝试了HTTP),请参阅底部的注释部分
编辑:由于目前它是单向的(客户端->服务器),我可以将客户端远程传递给服务器,尽管我很有兴趣知道有什么不同,因为我认为只要你有一个可读和可写的流,dnode就可以工作……
发布于 2013-07-27 09:14:06
弄清楚了,这里是诀窍,而不是:
var req = https.request(options, function(res) {
res.pipe(d).pipe(req);
});执行以下操作:
var req = https.request(options, function(res) {
res.pipe(d);
});
d.pipe(req);我错过了data的前几个活动
https://stackoverflow.com/questions/17886714
复制相似问题