amf_socket 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 89c47ec25bdc908dc2a5230193bf2b46b45363f8
4
- data.tar.gz: 4adc7c784eff7f2d4b0916530c67e97a5a11e54d
3
+ metadata.gz: c35655722b57918c2d2c95679c7f1a917daa39fa
4
+ data.tar.gz: 83060f2c71b94524a7a8e3ab0bbda8a33517348d
5
5
  SHA512:
6
- metadata.gz: 01d50d4c4b9330f9759d68ff37f98f1e03ab1a9afcfbfb246e08deb148da5834ba3c90d32ebcecde3d68d52764182dba88c708a3cdfd18f484219d27edc4bf96
7
- data.tar.gz: 32c432507e979fcc3efae7afd4d858c130ec1b010985e41831db41e08d87337bd596fa0cea94b5a598c6cf00c2b5be33016bf6952cdc564a015209260fb23991
6
+ metadata.gz: 13727696af4c8e150ca9ae90cfab18f5b7a6bc15016b881c4edd5872f130d0072859dbb8deeaf9334aafb026b6951a16dc1242698b6d49a7fdc7d125272d7fbe
7
+ data.tar.gz: 8b130be6b441e61d1a51560830c70a6fefc9bd02e2f65da0eae2bd869b079999385c79f84183c057f1f5b97f4247aae97afb13d2c26e126c0180d03ab693411b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- amf_socket (0.3.2)
4
+ amf_socket (0.3.3)
5
5
  RocketAMF (~> 0.2.1)
6
6
  eventmachine (~> 1.0.0)
7
7
 
@@ -37,7 +37,12 @@ class AmfSocket::AmfRpcConnection < AmfSocket::AmfConnection
37
37
  case object[:type]
38
38
  when 'rpcRequest'
39
39
  request = AmfSocket::RpcReceivedRequest.new(object, self)
40
- receive_request(request)
40
+ case request.command
41
+ when 'amf_socket_ping'
42
+ receive_ping_request(request)
43
+ else
44
+ receive_request(request)
45
+ end
41
46
  when 'rpcResponse'
42
47
  receive_response(object)
43
48
  when 'rpcMessage'
@@ -72,6 +77,11 @@ class AmfSocket::AmfRpcConnection < AmfSocket::AmfConnection
72
77
  request.reply("You should override #{self.class.to_s}#receive_request.")
73
78
  end
74
79
 
80
+ # Respond to server ping requests (when used with EM.connect for client side sockets).
81
+ def receive_ping_request(request)
82
+ request.reply(nil)
83
+ end
84
+
75
85
  # Override this method in your subclass.
76
86
  def receive_message(message)
77
87
  end
@@ -1,3 +1,3 @@
1
1
  module AmfSocket
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
@@ -28,6 +28,11 @@ class AmfRpcConnTestable < AmfSocket::AmfRpcConnection
28
28
  @received_requests << request
29
29
  end
30
30
 
31
+ def receive_ping_request(request)
32
+ $receive_ping_callback.call(request)
33
+ super
34
+ end
35
+
31
36
  def receive_message(message)
32
37
  @received_messages << message
33
38
  end
@@ -113,6 +118,28 @@ describe AmfSocket::AmfRpcConnection do
113
118
  request.connection.should == @conn
114
119
  end
115
120
 
121
+ it 'should handle received ping requests and reply' do
122
+ object = {
123
+ :type => 'rpcRequest',
124
+ :request => {
125
+ :messageId => '123',
126
+ :command => 'amf_socket_ping',
127
+ :params => {
128
+ :time => Time.now,
129
+ :latency => 0.5
130
+ }
131
+ }
132
+ }
133
+
134
+ $receive_ping_callback = proc { |request|
135
+ request.should_receive(:reply)
136
+ }
137
+
138
+ @conn.receive_object(object)
139
+
140
+ request = @conn.received_requests.first
141
+ end
142
+
116
143
  it 'should handle recevied messages' do
117
144
  object = {
118
145
  :type => 'rpcMessage',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amf_socket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Remesch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-15 00:00:00.000000000 Z
11
+ date: 2013-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine