websocket-client-simple 0.0.8 → 0.0.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: 3dd4ed6955248edc0106bc4733cf200dda9377b4
4
- data.tar.gz: 6f927343d77137d4d959d27f5236e89187bb3fca
3
+ metadata.gz: 4c77561031da6ed2b7c158b90a359714d86c9c4c
4
+ data.tar.gz: 5e3db2931d4fab5c52438b3dc4373ba69b604bac
5
5
  SHA512:
6
- metadata.gz: 01a5e2d8ea4cd948e0db55f8e8b03f42d24377a52022068adf28e755436fc544366e6056469b9b689c6b24ebdeca66252d06369ffdc854cceaa954026b4e5b19
7
- data.tar.gz: 21cf3f9e77005c682896b968ccde1ba195abb26c89a46b5684d84a987f3e5ea622698cd3eedfb20c5e02c4b23e00f3e4a2d675a84a5b636c8f285185813f709d
6
+ metadata.gz: 515e8e4fe7f48323186324b6271a25febe05a6b0e52f6e132fef21ff4caaf81dc7c7130ff1eb45c5c08aa34d89778f183ed61ce4ec51a991cba8812c3e5a58e1
7
+ data.tar.gz: 6b681526e86e0812d3c4bfdac5b23acac4584b367fc9cafae92915bb9798b4aae719d9d074b958fe5852612fe0d3184cdf54c25d8b0696308e433d2c9499a74c
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.0.9 2014-04-03
2
+
3
+ * emit "error" in receive thread
4
+ * rescue only Errno::EPIPE, not all Errors
5
+
1
6
  === 0.0.8 2014-01-29
2
7
 
3
8
  * bugfix Client#close #4
data/README.md CHANGED
@@ -5,7 +5,7 @@ Simple WebSocket Client for Ruby
5
5
  - https://github.com/shokai/websocket-client-simple
6
6
  - https://rubygems.org/gems/websocket-client-simple
7
7
 
8
- [![Build Status](https://travis-ci.org/shokai/websocket-client-simple.png)](https://travis-ci.org/shokai/websocket-client-simple)
8
+ [![Build Status](https://travis-ci.org/shokai/websocket-client-simple.png?branch=master)](https://travis-ci.org/shokai/websocket-client-simple)
9
9
 
10
10
 
11
11
  Installation
@@ -35,6 +35,10 @@ ws.on :close do |e|
35
35
  exit 1
36
36
  end
37
37
 
38
+ ws.on :error do |e|
39
+ p e
40
+ end
41
+
38
42
  loop do
39
43
  ws.send STDIN.gets.strip
40
44
  end
@@ -27,20 +27,20 @@ module WebSocket
27
27
  while !@closed do
28
28
  begin
29
29
  recv_data = @socket.getc
30
- rescue => e
31
- emit :__close, e
32
- end
33
- if !@handshaked
34
- @hs << recv_data
35
- if @hs.finished?
36
- @handshaked = true
37
- emit :open
38
- end
39
- else
40
- frame << recv_data
41
- while msg = frame.next
42
- emit :message, msg
30
+ if !@handshaked
31
+ @hs << recv_data
32
+ if @hs.finished?
33
+ @handshaked = true
34
+ emit :open
35
+ end
36
+ else
37
+ frame << recv_data
38
+ while msg = frame.next
39
+ emit :message, msg
40
+ end
43
41
  end
42
+ rescue => e
43
+ emit :error, e
44
44
  end
45
45
  end
46
46
  end
@@ -54,7 +54,7 @@ module WebSocket
54
54
  frame = ::WebSocket::Frame::Outgoing::Client.new(:data => data, :type => type, :version => @hs.version)
55
55
  begin
56
56
  @socket.write frame.to_s
57
- rescue => e
57
+ rescue Errno::EPIPE => e
58
58
  emit :__close, e
59
59
  end
60
60
  end
@@ -1,7 +1,7 @@
1
1
  module WebSocket
2
2
  module Client
3
3
  module Simple
4
- VERSION = "0.0.8"
4
+ VERSION = "0.0.9"
5
5
  end
6
6
  end
7
7
  end
data/sample/client.rb CHANGED
@@ -22,6 +22,10 @@ ws.on :close do |e|
22
22
  exit 1
23
23
  end
24
24
 
25
+ ws.on :error do |e|
26
+ puts "-- error (#{e.inspect})"
27
+ end
28
+
25
29
  loop do
26
30
  ws.send STDIN.gets.strip
27
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: websocket-client-simple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Hashimoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-29 00:00:00.000000000 Z
11
+ date: 2014-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler