Fixed socket.io connection url issue (with heroku)
Added check for when res mode is undefined