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 +4 -4
- data/.travis.yml +0 -1
- data/Gemfile.lock +6 -6
- data/History.txt +5 -0
- data/README.md +3 -0
- data/lib/socket.io-client-simple/client.rb +1 -1
- data/lib/socket.io-client-simple/version.rb +1 -1
- data/samples/chat_server.js +2 -0
- data/test/test_socket.io.rb +18 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53637062fd1f888bca99a916ad53579a82184658
|
4
|
+
data.tar.gz: a1938eb0b5cc6c5df5ff6d1e5e73c3fa2b6b6fa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f96621384ba80c5ee9528474b594a93056d331071443df72df1b4e313236e407eb32ac1a6d3824d2c6bf148b43715fad6ad17bda3e883c5667a25a86aa4239b
|
7
|
+
data.tar.gz: 8af155de0ee260969380caaf35adf9a6706df5adfb531f92bacbf7068582344cb8d9507c92032da5ff1bf41669a159cb9749ac17682e0441605092f889c83138
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
socket.io-client-simple (0.0.
|
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.
|
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.
|
18
|
+
minitest (5.3.4)
|
19
19
|
multi_xml (0.5.5)
|
20
|
-
rake (10.
|
21
|
-
websocket (1.1.
|
22
|
-
websocket-client-simple (0.0
|
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
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
|
data/samples/chat_server.js
CHANGED
@@ -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
|
});
|
data/test/test_socket.io.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2014-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|