added try/catch to connect to socket.io