Heat the chocolate in the coffee or water, stirring until melted. Simmer until slightly thickened but still falling easily from the spoon. Remove from the heat and beat the egg yolks one by one into the hot mixture so they thicken slightly. Beat in the butter and rum or vanilla. Let the mixture cool until tepid.