def decode_message(message)
      begin
        msg = MessagePack.unpack(message, symbolize_keys: true)
      rescue => ex
        raise InvalidMessageError, "couldn't unpack message: #{ex}"
      end
      begin
        klass = Utils.full_const_get msg[:type]
        o = klass.new(*msg[:args])
        o.id = msg[:id] if o.respond_to?(:id=) && msg[:id]
        o
      rescue => ex
        raise InvalidMessageError, "invalid message: #{ex}"
      end
    end
def decode_message(message)
      begin
        msg = MessagePack.unpack(message, symbolize_keys: true)
      rescue => ex
        raise InvalidMessageError, "couldn't unpack message: #{ex}"
      end
      begin
        klass = Utils.full_const_get msg[:type]
        o = klass.new(*msg[:args])
        o.id = msg[:id] if o.respond_to?(:id=) && msg[:id]
        o
      rescue => ex
        raise InvalidMessageError, "invalid message: #{ex}"
      end
    end
Decode incoming messages