first attempt to implement long polling in angularjs, currently working very buggy but it's easily fixable