Fix js

setInterval wouldn't work, as it was getting function call result, not function. But if connection failed onClose was making new reconnect object on each connect fail.