tubesock 0.2.8 → 0.2.9

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: 2414128908c4b854bc84367086ef5c09c1d472d7
4
- data.tar.gz: 8d23986a9aefc520aeb87faccd1ce28d2f96b454
3
+ metadata.gz: 7f0c9b5fc549d9c961037167cc3d1c4874c01b80
4
+ data.tar.gz: 8d10298543c45793683fc331e97eb7bcc8925f90
5
5
  SHA512:
6
- metadata.gz: 4eedd58e0c7d6f987aeaa4622c915543de76e37f8067d299d743ba6afc4ba7e598a2e5612636c312b6bb13f4a4d2a1855d5d6d3779795032d2976a15cd802737
7
- data.tar.gz: a354b382e477aaf864443a3dbb6285c749a5ecbdc75acdbaa3554d39a44b884b121d33ae668143ad0bbe4645eb28fe3a5a605b8d061d4e9a86de80bd560db85c
6
+ metadata.gz: 987a397c4a369312c9b508d884df4e4aad5cc5a63b0552f9ea65649205a2c785b168b308d1544eae7558597ad45ca82a923f7046bf704221b6954ac7d0aec8cc
7
+ data.tar.gz: 78cb47bee5cdab50d1e6176283d809998b871ed8e8044efc2477ed0a64b853135f675ce8fb036ff3c715748b02d8494dfb8c5ad67e6c5594d59fcc5b10ee5530
@@ -142,6 +142,11 @@ class Tubesock
142
142
  return
143
143
  when :text, :binary
144
144
  yield frame.data
145
+ when :ping
146
+ # According to https://tools.ietf.org/html/rfc6455#section-5.5.3:
147
+ # A Pong frame sent in response to a Ping frame must have identical "Application data" as
148
+ # found in the message body of the Ping frame being replied to.'
149
+ send_data frame.data, :pong
145
150
  end
146
151
  end
147
152
  end
@@ -1,3 +1,3 @@
1
1
  class Tubesock
2
- VERSION = "0.2.8"
2
+ VERSION = "0.2.9"
3
3
  end
@@ -51,11 +51,15 @@ class Tubesock::TestCase::TestInteraction
51
51
  ).to_s
52
52
  end
53
53
 
54
- def read
54
+ def read_frame
55
55
  framebuffer = WebSocket::Frame::Incoming::Client.new(version: version)
56
56
  data, _addrinfo = @client_socket.recvfrom(2000)
57
57
  framebuffer << data
58
- framebuffer.next.data
58
+ framebuffer.next
59
+ end
60
+
61
+ def read
62
+ read_frame.data
59
63
  end
60
64
 
61
65
  def join
@@ -55,6 +55,20 @@ class TubesockTest < Tubesock::TestCase
55
55
  closed.called.must_equal true
56
56
  end
57
57
 
58
+ def test_pong_on_ping_frame
59
+ interaction = TestInteraction.new
60
+ interaction.tubesock {}
61
+
62
+ # Client ping frame from: WebSocket::Frame::Outgoing::Client.new(version: 13, data: "\x1d\xcc\x18G", type: :ping).to_s
63
+ interaction.write_raw "\x89\x84$\xBE\xDAy9r\xC2>".force_encoding('binary')
64
+
65
+ frame = interaction.read_frame
66
+ frame.data.must_equal "\x1d\xcc\x18G".force_encoding('binary')
67
+ frame.type.must_equal :pong
68
+
69
+ interaction.close
70
+ end
71
+
58
72
  def test_onerror_callback
59
73
  interaction = TestInteraction.new
60
74
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tubesock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Gauthier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-14 00:00:00.000000000 Z
11
+ date: 2018-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack