Fixed the message handler static dispatch to correctly work with multiple clients.

Statefull functions are not the way to go, to easy to get wrong. Made
a struct that holds this specific state and gets destructed/constructed
with every new client/clientendpoint