socket.io-client-simple 0.0.4 → 0.0.5

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: ca39a2d97fba9da766dd7edfbded68e11ef951ad
4
- data.tar.gz: 31a4bc8c19ef89d26ea4135240ca2a87d293f018
3
+ metadata.gz: 94a92db513c52a1c4b15b58a43136c2011aaedbe
4
+ data.tar.gz: 4f1417e7046138213cbbca0dacfb933518f352d5
5
5
  SHA512:
6
- metadata.gz: 9a0e356b8463f7c5755e3c1944a1cf2b2eb9ef750d4fb079865987b9c63b907940006f5c5ae6a36bfcfa49b9a0bda6a956c62856d703094a3d3df16c11699fe7
7
- data.tar.gz: ed335e51e2e4f3e170952f424fd884d8c6cbe02463c81fa79d7ffcf47c3ed97f030ac40749fabee9bd82913a59a596e5234ef2bef6f911063a7d9c3fdb83d177
6
+ metadata.gz: dd35c387b451f32139716f3f679442ebb73a52bff167cc66b2f8a78abce3e1178bf65a97ce1f4fcaef220f02d1672955452af4d989ee0b1655e0e3c4fdaa40e3
7
+ data.tar.gz: 91a3ce75d3a4a8188f4f0e77a3399397a31499f9a4f0091e472e05b2b26109683c9d87415e8a70509c96bfd283bb25330ddad32f32634ee8a9460e3af367c8c5
data/Gemfile.lock CHANGED
@@ -1,25 +1,25 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- socket.io-client-simple (0.0.4)
4
+ socket.io-client-simple (0.0.5)
5
5
  event_emitter
6
6
  httparty
7
7
  json
8
- websocket-client-simple (>= 0.0.6)
8
+ websocket-client-simple (>= 0.0.9)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
13
  event_emitter (0.2.5)
14
- httparty (0.12.0)
14
+ httparty (0.13.0)
15
15
  json (~> 1.8)
16
16
  multi_xml (>= 0.5.2)
17
17
  json (1.8.1)
18
- minitest (5.2.1)
18
+ minitest (5.3.1)
19
19
  multi_xml (0.5.5)
20
- rake (10.1.1)
20
+ rake (10.2.2)
21
21
  websocket (1.1.2)
22
- websocket-client-simple (0.0.6)
22
+ websocket-client-simple (0.0.9)
23
23
  event_emitter
24
24
  websocket
25
25
 
data/History.txt CHANGED
@@ -1,17 +1,22 @@
1
- === 0.0.4 2014-1-20
1
+ === 0.0.5 2014-04-03
2
+
3
+ * emit "error" event
4
+ * rescue only Errno::ECONNREFUSED
5
+
6
+ === 0.0.4 2014-01-20
2
7
 
3
8
  * add accessor Client#url
4
9
 
5
- === 0.0.3 2014-1-20
10
+ === 0.0.3 2014-01-20
6
11
 
7
12
  * reconnect on socket.io disconnect
8
13
  * add Tests, use Travis-CI
9
14
 
10
- === 0.0.2 2014-1-18
15
+ === 0.0.2 2014-01-18
11
16
 
12
17
  * bugfix "disconnect" event
13
18
 
14
- === 0.0.1 2014-1-15
19
+ === 0.0.1 2014-01-15
15
20
 
16
21
  * first release
17
22
  * implemented "emit" and "on"
data/README.md CHANGED
@@ -4,7 +4,7 @@ A simple ruby client for node.js's socket.io. Supports only WebSocket.
4
4
  - https://github.com/shokai/ruby-socket.io-client-simple
5
5
  - https://rubygems.org/gems/socket.io-client-simple
6
6
 
7
- [![Travis-CI Build Status](https://travis-ci.org/shokai/ruby-socket.io-client-simple.png)](https://travis-ci.org/shokai/ruby-socket.io-client-simple)
7
+ [![Travis-CI Build Status](https://travis-ci.org/shokai/ruby-socket.io-client-simple.png?branch=master)](https://travis-ci.org/shokai/ruby-socket.io-client-simple)
8
8
 
9
9
  ## Install
10
10
 
@@ -32,6 +32,10 @@ socket.on :chat do |data|
32
32
  puts "> " + data['msg']
33
33
  end
34
34
 
35
+ socket.on :error do |err|
36
+ p err
37
+ end
38
+
35
39
  puts "please input and press Enter key"
36
40
  loop do
37
41
  msg = STDIN.gets.strip
@@ -39,7 +39,7 @@ module SocketIO
39
39
  res = nil
40
40
  begin
41
41
  res = HTTParty.get "#{@url}/socket.io/1/"
42
- rescue => e
42
+ rescue Errno::ECONNREFUSED => e
43
43
  @reconnecting = false
44
44
  reconnect
45
45
  return
@@ -56,13 +56,18 @@ module SocketIO
56
56
  end
57
57
  begin
58
58
  @websocket = WebSocket::Client::Simple.connect "#{@url}/socket.io/1/websocket/#{@session_id}"
59
- rescue => e
59
+ rescue Errno::ECONNREFUSED => e
60
60
  @reconnecting = false
61
61
  reconnect
62
62
  return
63
63
  end
64
64
 
65
65
  this = self
66
+
67
+ @websocket.on :error do |err|
68
+ this.__emit :error, err
69
+ end
70
+
66
71
  @websocket.on :message do |msg|
67
72
  code, body = msg.data.scan(/^(\d+):{2,3}(.*)$/)[0]
68
73
  code = code.to_i
@@ -1,7 +1,7 @@
1
1
  module SocketIO
2
2
  module Client
3
3
  module Simple
4
- VERSION = "0.0.4"
4
+ VERSION = "0.0.5"
5
5
  end
6
6
  end
7
7
  end
data/samples/sample.rb CHANGED
@@ -20,6 +20,10 @@ socket.on :chat do |data|
20
20
  puts "> " + data['msg']
21
21
  end
22
22
 
23
+ socket.on :error do |err|
24
+ p err
25
+ end
26
+
23
27
  puts "please input and press Enter key"
24
28
  loop do
25
29
  msg = STDIN.gets.strip
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "minitest"
24
24
 
25
25
  spec.add_dependency "json"
26
- spec.add_dependency "websocket-client-simple", '>= 0.0.6'
26
+ spec.add_dependency "websocket-client-simple", '>= 0.0.9'
27
27
  spec.add_dependency "httparty"
28
28
  spec.add_dependency "event_emitter"
29
29
  end
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socket.io-client-simple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
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-20 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
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: json
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: websocket-client-simple
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.0.6
75
+ version: 0.0.9
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.0.6
82
+ version: 0.0.9
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: httparty
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: event_emitter
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  description: A simple ruby client for node.js's socket.io. Supports only WebSocket.
@@ -115,8 +115,8 @@ executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
- - .gitignore
119
- - .travis.yml
118
+ - ".gitignore"
119
+ - ".travis.yml"
120
120
  - Gemfile
121
121
  - Gemfile.lock
122
122
  - History.txt
@@ -145,12 +145,12 @@ require_paths:
145
145
  - lib
146
146
  required_ruby_version: !ruby/object:Gem::Requirement
147
147
  requirements:
148
- - - '>='
148
+ - - ">="
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  requirements:
153
- - - '>='
153
+ - - ">="
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0'
156
156
  requirements: []