Mix cocoa, cornstarch, sugar, and salt, then add milk gradually, add in the beaten egg yolks while stirring in a pot over medium to medium-high heat on your stovetop.
Cook until thick, whisking it until smooth. Don't stop stirring or leave the pot until it's nice and thick like pudding.
Cream Pies take some time to thicken, so stir for (5-10 minutes or until thickened). Using a heavy bottom pan really helps. Just keep it up until it thickens, add vanilla in after you take the pan off the heat and 1 Tbs of butter. Pour into a pre-baked pie shell. Put in the fridge to chill, and add whipped cream if you like. Or use the leftover egg whites for a meringue topping!
