implement longpoll as an EventSource fallback

if window.EventSource exits use it. if it fails (server doesn't support it),
try longpolled mode.
if window.EventSource doesn't exits go for the longpolled mode directly.