Protocol extension

i need to extend the protocol with a custom client, but I’m having a hard time figuring out how the protocol extension mechanism work. frankly im a little frustrated with how little documentation and community support there is. can someone please point me to some code snippet so i can figure this thing out? thanks!