socket.io-client-simple 0.0.5 → 0.0.6

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: 94a92db513c52a1c4b15b58a43136c2011aaedbe
4
- data.tar.gz: 4f1417e7046138213cbbca0dacfb933518f352d5
3
+ metadata.gz: 53637062fd1f888bca99a916ad53579a82184658
4
+ data.tar.gz: a1938eb0b5cc6c5df5ff6d1e5e73c3fa2b6b6fa7
5
5
  SHA512:
6
- metadata.gz: dd35c387b451f32139716f3f679442ebb73a52bff167cc66b2f8a78abce3e1178bf65a97ce1f4fcaef220f02d1672955452af4d989ee0b1655e0e3c4fdaa40e3
7
- data.tar.gz: 91a3ce75d3a4a8188f4f0e77a3399397a31499f9a4f0091e472e05b2b26109683c9d87415e8a70509c96bfd283bb25330ddad32f32634ee8a9460e3af367c8c5
6
+ metadata.gz: 3f96621384ba80c5ee9528474b594a93056d331071443df72df1b4e313236e407eb32ac1a6d3824d2c6bf148b43715fad6ad17bda3e883c5667a25a86aa4239b
7
+ data.tar.gz: 8af155de0ee260969380caaf35adf9a6706df5adfb531f92bacbf7068582344cb8d9507c92032da5ff1bf41669a159cb9749ac17682e0441605092f889c83138
data/.travis.yml CHANGED
@@ -4,6 +4,5 @@ node_js:
4
4
  rvm:
5
5
  - 1.9.3
6
6
  - 2.0.0
7
- - jruby-head
8
7
  before_script:
9
8
  - npm install
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- socket.io-client-simple (0.0.5)
4
+ socket.io-client-simple (0.0.6)
5
5
  event_emitter
6
6
  httparty
7
7
  json
@@ -11,15 +11,15 @@ GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
13
  event_emitter (0.2.5)
14
- httparty (0.13.0)
14
+ httparty (0.13.1)
15
15
  json (~> 1.8)
16
16
  multi_xml (>= 0.5.2)
17
17
  json (1.8.1)
18
- minitest (5.3.1)
18
+ minitest (5.3.4)
19
19
  multi_xml (0.5.5)
20
- rake (10.2.2)
21
- websocket (1.1.2)
22
- websocket-client-simple (0.0.9)
20
+ rake (10.3.2)
21
+ websocket (1.1.4)
22
+ websocket-client-simple (0.2.0)
23
23
  event_emitter
24
24
  websocket
25
25
 
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.0.6 2014-06-08
2
+
3
+ * use 2nd argment of method "SocketIO::Client::Simple.connect" as handshake query parameter #5
4
+ * thank you for contributing @mallowlabs
5
+
1
6
  === 0.0.5 2014-04-03
2
7
 
3
8
  * emit "error" event
data/README.md CHANGED
@@ -20,6 +20,9 @@ require 'socket.io-client-simple'
20
20
 
21
21
  socket = SocketIO::Client::Simple.connect 'http://localhost:3000'
22
22
 
23
+ ## connect with parameter
24
+ socket = SocketIO::Client::Simple.connect 'http://localhost:3000', :foo => "bar"
25
+
23
26
  socket.on :connect do
24
27
  puts "connect!!!"
25
28
  end
@@ -38,7 +38,7 @@ module SocketIO
38
38
  def connect
39
39
  res = nil
40
40
  begin
41
- res = HTTParty.get "#{@url}/socket.io/1/"
41
+ res = HTTParty.get "#{@url}/socket.io/1", :query => @opts
42
42
  rescue Errno::ECONNREFUSED => e
43
43
  @reconnecting = false
44
44
  reconnect
@@ -1,7 +1,7 @@
1
1
  module SocketIO
2
2
  module Client
3
3
  module Simple
4
- VERSION = "0.0.5"
4
+ VERSION = "0.0.6"
5
5
  end
6
6
  end
7
7
  end
@@ -5,9 +5,11 @@ var io = require('socket.io').listen(port);
5
5
  console.log("socket.io server start - port:"+port);
6
6
 
7
7
  io.sockets.on('connection', function(socket){
8
+ var user = socket.manager.handshaken[socket.id].query.user;
8
9
  socket.emit('chat', {msg: 'hello world (from server)'});
9
10
  socket.on('chat', function(data){
10
11
  console.log(data);
12
+ data.user = user;
11
13
  socket.emit('chat', data); // echo
12
14
  });
13
15
  });
@@ -32,4 +32,22 @@ class TestSocketIOClientSimple < MiniTest::Test
32
32
  assert_equal post_data, result
33
33
  end
34
34
 
35
+ def test_connect_with_query_parameter
36
+ user = "hashimoto.shokai"
37
+ socket = SocketIO::Client::Simple.connect TestServer.url, :user => user
38
+
39
+ result = nil
40
+
41
+ socket.on :chat do |data|
42
+ result = data['user']
43
+ end
44
+
45
+ socket.on :connect do
46
+ socket.emit :chat, {"msg" => "hello (query parameter test)", "at" => Time.now.to_s}
47
+ end
48
+ sleep 0.5
49
+
50
+ assert_equal result, user
51
+ end
52
+
35
53
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socket.io-client-simple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
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-04-02 00:00:00.000000000 Z
11
+ date: 2014-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler