tubesock 0.2.1 → 0.2.2

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: 98b9142f247f9e2022ff5626f8b0a3ab352a182d
4
- data.tar.gz: 7bbce8c9207ecde3c9defa17e59bee69cef2b51f
3
+ metadata.gz: c48da440c1ae157b46aa7ea662935192dbeec123
4
+ data.tar.gz: bb35b9be6dbb7c63de9d0cfca245629d55acf3c0
5
5
  SHA512:
6
- metadata.gz: 63e99f053868723800d97737be978438f92080b7ef80e50a0b83cea7544b940c7f53ba373a90951427a07b7f64c1fe98cbd8a7d6a4aab519b82b7253b4969e43
7
- data.tar.gz: 7982ff410c1ca3cb3b48871c50ea52532f2bfaf25d0f5226d8e7a3d1ba11411057c4482d7cdfdcbdeff298f44407ec55571ecbcbc468b3d20c577188fe6ed613
6
+ metadata.gz: d99b7f0fda2a63d65563f08b12d1033138311ce2e4efe42cc9251c1fddc43cda758018d26734898937d6f1a04208d4040221e0f666d2f5a30b0abd4bfce32123
7
+ data.tar.gz: c0fd8b3ec5a98296b2e871fbceb92805ad91d2aa032cc489904d3ad0b03ded56ce7230f616eb164ef1201c0504e157c1b5f7709cc0914cf16d3e4afb50ce9563
data/lib/tubesock.rb CHANGED
@@ -39,7 +39,7 @@ class Tubesock
39
39
  type: type
40
40
  )
41
41
  @socket.write frame.to_s
42
- rescue IOError
42
+ rescue IOError, Errno::EPIPE
43
43
  close
44
44
  end
45
45
 
@@ -73,17 +73,17 @@ class Tubesock
73
73
  end
74
74
 
75
75
  def keepalive
76
- Thread.new do
76
+ thread = Thread.new do
77
77
  Thread.current.abort_on_exception = true
78
78
  loop do
79
79
  sleep 5
80
- ping
80
+ send_data nil, :ping
81
81
  end
82
82
  end
83
- end
84
83
 
85
- def ping
86
- send_data "tubesock-ping", :ping
84
+ onclose do
85
+ thread.kill
86
+ end
87
87
  end
88
88
 
89
89
  private
@@ -94,8 +94,12 @@ class Tubesock
94
94
  break if data.empty?
95
95
  framebuffer << data
96
96
  while frame = framebuffer.next
97
- return if frame.type == :close
98
- yield frame.data
97
+ case frame.type
98
+ when :close
99
+ return
100
+ when :text, :binary
101
+ yield frame.data
102
+ end
99
103
  end
100
104
  end
101
105
  rescue Errno::ECONNRESET
@@ -1,3 +1,3 @@
1
1
  class Tubesock
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
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.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Gauthier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-19 00:00:00.000000000 Z
11
+ date: 2013-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -147,10 +147,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  version: '0'
148
148
  requirements: []
149
149
  rubyforge_project:
150
- rubygems_version: 2.0.3
150
+ rubygems_version: 2.0.5
151
151
  signing_key:
152
152
  specification_version: 4
153
153
  summary: Handle websocket connections via Rack and Rails 4 using concurrency
154
154
  test_files:
155
155
  - test/test_helper.rb
156
156
  - test/tubesock_test.rb
157
+ has_rdoc: