implemented http event listeners for data error and end