Skip to content
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

Socket Hangup Issue #85

Open
jAddict7 opened this issue Jan 1, 2020 · 0 comments
Open

Socket Hangup Issue #85

jAddict7 opened this issue Jan 1, 2020 · 0 comments

Comments

@jAddict7
Copy link

jAddict7 commented Jan 1, 2020

Dear Sir,
Thanks for the awesome work. We have GPS server running Node JS, from where the co-ordinates are pushed to another server using HTTPS node module. Every second we need to send around 60-80 requests. Node JS is running out of memory, so on regular basis we restart the server. When we restart, requests are hanged for several hours and triggered only for every 5 seconds. And rest are hanged and not working. After some hours, it works fine even with high load of 80 requests per second.

const query = JSON.stringify({
	'device_id': XXX,
	'items': YYY,
});

const options = {
	hostname: 'HOST',
	port: 443,
	path: 'Page Link',
	method: 'POST',
	headers: {
		'Connection': 'keep-alive',
		'Content-Type': 'application/json',
		'Content-Length': query.length
	}
};

var request = https.request(options, (res) => {
	res.on('data', (data) => {
		console.log('Response Data :: '+data);
	}).on('end', () => {});
	res.on('error', (e) => {
		console.error('Response :: '+e);
	});
});

request.on('error', (e) => {
	console.error('Request :: '+e);
});
request.write(query);
request.end();

We request to the same URL. Is there any problem in the implementation? Will our module save us from the problem we are into? Please do guide us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant