This thread would probably be worth a read: GatewayHook getRPCHandler Implementation - #3 by Kevin.Herron