I would like to make an AMF request body the same as the followings (Charles log):
As show in Charles, it has and a "Command" value Object and a "CCLocalPlayerChanges" value Object. I am confused with the Value for such object, how can I make them using RocketAMF?
I have tried using hash for such object:
data = [{
:method => "load",
:service => "start.game",
:player_delta => {:stamina => 0},
:sequence_num => self.sequence_num,
:transaction_time => Time.now.to_i.to_s,
:icp => 0,
}]
env = RocketAMF::Envelope.new :amf_version => 3
env.messages << RocketAMF::Message.new('BatchController.authenticate_iphone', '/1', data)
body = env.to_s
res = RestClient.post "http://localhost/amf", env.to_s, :content_type => 'application/x-amf'
Or ClassMapping:
class ClassCommand; attr_accessor :service, :sequence_num, :transaction_time, :icp; end;
command_obj = ClassCommand.new
command_obj.service = "start.game"
command_obj.sequence_num = 0
command_obj.transaction_time = Time.now.to_i.to_s
command_obj.icp = 0
RocketAMF::ClassMapper.define {|m| m.map :as => 'Command', :ruby => 'ClassCommand'}
data = [command_obj]
env = RocketAMF::Envelope.new :amf_version => 3
env.messages << RocketAMF::Message.new('BatchController.authenticate_iphone', '/1', data)
body = env.to_s
res = RestClient.post "http://localhost/amf", env.to_s, :content_type => 'application/x-amf'
But neither of them gives me the Value (as can see below, both objects' value are empty from Charles):
I am new to AMF, so wondering does it actually matter if the object value is empty and how to make them with RocketAMF gem.