在node.js中获取opensslstream

我有一个使用TLS 1.0的服务器,它给了我一个无限的数据stream在terminal上的命令

~$ openssl s_client -connect 'serveraddress':5000 

这为我提供了一个我的服务器正在做什么的实时xml数据stream。 我想用node.js或其他任何方式连接到它,使我有可能将这个数据stream作为一个websocket或直接到一个JS,但我似乎无法弄清楚如何。 你能帮忙吗? 谢谢 :)

我觉得像这样的东西应该可以解决你的问题。

 var terminal = require('child_process').spawn('bash'); terminal.stdout.on('data', function (data) { console.log('stdout: ' + data); }); terminal.on('exit', function (code) { console.log('child process exited with code ' + code); }); setTimeout(function() { console.log('Sending stdin to terminal'); terminal.stdin.write("openssl s_client -connect 'serveraddress':5000"); terminal.stdin.end(); }, 1000); 

编辑:尝试这个工作的例子:

 terminal.stdin.write("ping www.google.de");