In a medium saucepan over low heat, melt the butter with the heavy cream, stirring gently until smooth.
Add the sugar and cocoa powder (or chopped chocolate). Whisk continuously until fully dissolved and glossy.
Increase the heat slightly and bring the mixture to a gentle simmer. Avoid rapid boiling.
Simmer for 4–6 minutes, stirring often, until the sauce thickens and coats the back of a spoon.
Remove from heat and stir in the vanilla extract and sea salt.
Let the sauce rest for a few minutes before serving. It will continue to thicken as it cools slightly.