generic way of connecting to socket.io