add connection connected status for client connection

Signed-off-by: Mark Ellzey <socket@gmail.com>
Added on_event hook / cleanup
Fixed bug with calling user-defined event callback :)

Don't do: (*cb)(stuff), do (cb)(stuff) <- mark is an idiot