Couldn't you just save the currently active query in the local scope (as you're doing with socket.id) and compare directly?