def on_event(channel_id, method, callable=nil, &block)
      handler = block || callable
      raise ArgumentError, "expected block or callable as the event handler" \
        unless handler.respond_to?(:call)
      
      @event_handlers[Integer(channel_id)][method.to_sym] = handler
      handler
    end
def on_event(channel_id, method, callable=nil, &block)
      handler = block || callable
      raise ArgumentError, "expected block or callable as the event handler" \
        unless handler.respond_to?(:call)
      
      @event_handlers[Integer(channel_id)][method.to_sym] = handler
      handler
    end
Register a handler for events on the given channel of the given type.
 Only one handler for each event type may be registered at a time.
 If no callable or block is given, the handler will be cleared.

 @param channel_id [Integer] The channel number to watch for.
 @param method [Symbol] The type of protocol method to watch for.
 @param callable [#call,nil] The callable handler if no block is given.
 @param block [Proc,nil] The handler block to register.
 @return [Proc,#call,nil] The given block or callable.
 @yieldparam event [Hash] The event passed to the handler.