-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
close stream #25
Comments
I'v fixed it, using res.on('data', function(data) {
if(res.res&&res.res.client)
res.res.client.destroy();
}); but maybe it would be nice to add a function res.close() or res.destroy(); |
also, you can use a shorter way than overriding request, by using directly net sockets like here function rawget(url, fn) {
var u = require('url').parse(url);
require('dns').resolve(u.hostname, function(err, addresses) {
var ip=u.hostname;
if(addresses)
ip = addresses[0];
var client = new require('net').Socket();
client.connect(u.port, ip, function() {
client.write('Get ' + u.path + ' HTTP/1.0\r\n');
client.write('User-Agent: Mozilla/5.0\r\n');
client.write('\r\n');
});
client.on('data', function(data) {
fn(data);
client.destroy(); // short message, needs streaming for long ones
});
client.on('close', function() {
console.log('socket.close');
});
});
} |
Thank you for your effort! This method saved me tons of time! |
The socket of icecast request was kept open even if the request itself was ended via the end() method. See related issues: - TooTallNate/node-icy#25 - TooTallNate/node-icy#22
fix 2018
|
I'm using node-icy to scan streams, but all streams stay opened... how I can close/destroy a stream response ?
The text was updated successfully, but these errors were encountered: