Extract streaming ajax api to anoter file. TODO: send ajax parameters