How Joffrey dies is sign-posted in A Clash of Kings - Maester Cressen's failed assassination attempt on Melisandre in the prologue, and what Dontos says to Sansa in her 8th POV chapter in that book...
Added to which, the Ghost of High Heart's dreams, as related to the Brotherhood Without Banners in Chapter 43 (Arya VII) of ASoS are another huge clue.