So i'm have an app with Socket.IO
which purpose is to search some data on different sites. Something like crawler... The main problem is that the search process is too long and while it happens my app stucks... For example if one user starts to search second need to wait until first completed...
Each site which need to be searched is represented as a separate class so i do something like:
selected_sites.forEach(function(site_name) {
var site = new sites[site_name];
site.on('found', function(data) {
socket.emit('found', data);
});
site.on('not_found', function() {
socket.emit('not_found', 'Nothing found at ' + site.getSiteName());
});
site.search(socket_data.params);
});
Is it possible somehow to move the "class body | search progress" "somewhere else | in a new thread" so that event loop not be blocked while search in progress?