When I connect to a remote host via SSH, I like to start a new Tmux session or re-attach to an existing one. Before that’s how I was doing it:

if tmux has-session
then
    tmux attach-session
else
    tmux new-session
fi

There’s something much simpler: tmux attach || tmux new