Compact metric connected space
We may show any function $f:X\to \{0,1\}$ that is continuous must be constant, where $\{0,1\}$ is endowed with the discrete topology, let $\rho$ be the discrete metric.
Pick $x\in X$, and keep it fixed. Now pick any other $y\in X$. Since $f$ is continuous and $X$ is compact, $f$ is uniformly continuous by Heine-Cantor. Thus given $\eta >0$, there exists $\varepsilon >0$ such that $d(z',z)<\varepsilon\implies \rho(f(z'),f(z))<\eta$. Let's pick $0<\eta<1$, so that $d(z',z)<\varepsilon\implies f(z')=f(z)$.
Now, given this $\varepsilon$; chain up $x$ to $y$ by $x=x_0,x_1,\ldots,x_n=y$ and $d(x_i,x_{i+1})<\varepsilon$. Then $f(x)=f(x_0)=f(x_1)=\cdots=f(x_n)=f(y)$. Since $y$ was arbitrary, $f(y)=f(x)$ for any $y\in X$, so $f$ is constant, and $X$ is connected.
Suppose $X$ wasn't connected. Let $A$ be a non-trivial clopen in $X$, and let $B=X\setminus A$.
Then $A$ and $B$ are closed, hence compact, subsets of $X$, so there exist $a\in A$ and $b\in B$ such that $$d(a,b)=\min\left\{d(x,y):x\in A, y\in B\right\}.$$ By assumption, there exists a sequence $a=x_1,\ldots,x_n=b$ satisfying $d(x_i,x_{i+1})<d(a,b)$. Let $i_0=\max\left\{i:x_i\in A\right\}$. Then $x_i\in A$ and $x_{i+1}\in X\setminus A$, and $d(a,b)\leq d(x_i,x_{i+1})<d(a,b)$, a contradiction.
Therefore, $X$ is connected.