Transform TCP sockets into custom event emitters