drb-websocket 0.4.0 → 0.5.0

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
  SHA256:
3
- metadata.gz: c2b32ebe2bfd968d7c059fe793877dc8d991c40cd783aa3e09747e74cdfebb6b
4
- data.tar.gz: ab794959933f89028c7b31b75e61a0dfd7444f268a5de262b8d4e8f8e2ad2e6e
3
+ metadata.gz: a45fcb51e428c61444bbee61bc8652f8fe7ce4569f9ce8dda558de99be697f83
4
+ data.tar.gz: d103f546870476188c292479c085efe24993a61d1a8ec3efdbc068346eaa4103
5
5
  SHA512:
6
- metadata.gz: 36cdc524946deb717b49c50183a48c87f8efe2857986b6d0a9f6ced795d3380853258a68e9d86b95fef6c0dd31e11512b13ce5329b4b9b559681ff4dd456bba1
7
- data.tar.gz: 8fe1f109859622d83654b8fe9981c0cc7585bd7b0b05e033afcb615063d52ae67b16a5e4368081e1cbbd05a2dc955d67c6ff590366bf1a1471430419a8699982
6
+ metadata.gz: 879b10e9576a233a0ab2a8000c237caca72a9401cdd90b6d86d9d23b7c3ce212972a9fb32e22d0e59c10d3faeebacb8cabdfcb0fa61c5e125ef782edd9913375
7
+ data.tar.gz: 8f562ac8da96ddc2f72d46578eb56d7020c7081cf00ba780e250c0f9f8e085b7ed1a449d67a90f7342c49e2d5b3fde89d4c1725c9485bf9240012727be748016
data/.gitignore CHANGED
@@ -44,7 +44,7 @@ build-iPhoneSimulator/
44
44
 
45
45
  # for a library or gem, you might want to ignore these files since the code is
46
46
  # intended to run in multiple environments; otherwise, check them in:
47
- # Gemfile.lock
47
+ Gemfile.lock
48
48
  # .ruby-version
49
49
  # .ruby-gemset
50
50
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- drb-websocket (0.1.0)
4
+ drb-websocket (0.4.0)
5
5
  faye-websocket
6
6
  rack
7
7
  thin
@@ -9,19 +9,19 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- daemons (1.2.4)
13
- eventmachine (1.2.3)
12
+ daemons (1.2.6)
13
+ eventmachine (1.2.7)
14
14
  faye-websocket (0.10.7)
15
15
  eventmachine (>= 0.12.0)
16
16
  websocket-driver (>= 0.5.1)
17
- rack (2.0.3)
17
+ rack (2.0.6)
18
18
  thin (1.7.2)
19
19
  daemons (~> 1.0, >= 1.0.9)
20
20
  eventmachine (~> 1.0, >= 1.0.4)
21
21
  rack (>= 1, < 3)
22
- websocket-driver (0.6.5)
22
+ websocket-driver (0.7.0)
23
23
  websocket-extensions (>= 0.1.0)
24
- websocket-extensions (0.1.2)
24
+ websocket-extensions (0.1.3)
25
25
 
26
26
  PLATFORMS
27
27
  ruby
@@ -30,4 +30,4 @@ DEPENDENCIES
30
30
  drb-websocket!
31
31
 
32
32
  BUNDLED WITH
33
- 1.14.6
33
+ 1.17.1
data/examples/client.rb CHANGED
@@ -1,6 +1,15 @@
1
1
  require 'drb/websocket'
2
2
 
3
3
  factory = DRbObject.new_with_uri "ws://127.0.0.1:1234"
4
+ DRb.start_service("ws://127.0.0.1:1234/callback")
4
5
 
5
6
  remote = factory.get
6
- puts remote.test
7
+
8
+ 5.times do
9
+ puts remote.test
10
+ sleep 1
11
+ end
12
+
13
+ remote.set_callback do
14
+ puts "got callback"
15
+ end
data/examples/server.rb CHANGED
@@ -1,10 +1,17 @@
1
1
  require 'drb/drb'
2
- require 'drb/websocket/server'
2
+ require 'drb/websocket'
3
3
 
4
4
  class SampleObject
5
5
  def test
6
6
  "ACK!"
7
7
  end
8
+
9
+ def set_callback(&callback)
10
+ 5.times do
11
+ callback.call
12
+ sleep 1
13
+ end
14
+ end
8
15
  end
9
16
 
10
17
  class SampleFactory
@@ -6,8 +6,12 @@ module DRb
6
6
  def initialize(uri, config)
7
7
  @uri = uri
8
8
  @config = config
9
- @wsclient = WSClient.new(uri)
10
9
  @queue = Thread::Queue.new
10
+ reconnect
11
+ end
12
+
13
+ def reconnect
14
+ @wsclient = WSClient.new(uri)
11
15
 
12
16
  @wsclient.on(:message) do |event|
13
17
  message = event.data
@@ -17,13 +21,17 @@ module DRb
17
21
  end
18
22
 
19
23
  def close
20
- @wsclient.close
21
- @wsclient = nil
24
+ EM.defer do
25
+ @wsclient.close
26
+ @wsclient = nil
27
+ end
22
28
  end
23
29
 
24
30
  def accept
25
31
  (sender_id, message) = @queue.pop
26
- ServerSide.new(@wsclient, sender_id, message, @config, @uri)
32
+ server_side = ServerSide.new(@wsclient, sender_id, message, @config, @uri)
33
+ reconnect
34
+ server_side
27
35
  end
28
36
 
29
37
  class ServerSide
@@ -1,5 +1,5 @@
1
1
  module Drb
2
2
  module Websocket
3
- VERSION = "0.4.0"
3
+ VERSION = "0.5.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drb-websocket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - youchan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-10 00:00:00.000000000 Z
11
+ date: 2018-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faye-websocket
@@ -103,7 +103,6 @@ extra_rdoc_files: []
103
103
  files:
104
104
  - ".gitignore"
105
105
  - Gemfile
106
- - Gemfile.lock
107
106
  - LICENSE
108
107
  - README.md
109
108
  - Rakefile
@@ -140,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
139
  version: '0'
141
140
  requirements: []
142
141
  rubyforge_project:
143
- rubygems_version: 2.7.3
142
+ rubygems_version: 2.7.6
144
143
  signing_key:
145
144
  specification_version: 4
146
145
  summary: A druby protocol of WebSocket.
data/Gemfile.lock DELETED
@@ -1,51 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- drb-websocket (0.4.0)
5
- faye-websocket
6
- rack
7
- thin
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- daemons (1.2.6)
13
- diff-lcs (1.3)
14
- eventmachine (1.2.5)
15
- faye-websocket (0.10.7)
16
- eventmachine (>= 0.12.0)
17
- websocket-driver (>= 0.5.1)
18
- rack (2.0.4)
19
- rake (10.5.0)
20
- rspec (3.7.0)
21
- rspec-core (~> 3.7.0)
22
- rspec-expectations (~> 3.7.0)
23
- rspec-mocks (~> 3.7.0)
24
- rspec-core (3.7.0)
25
- rspec-support (~> 3.7.0)
26
- rspec-expectations (3.7.0)
27
- diff-lcs (>= 1.2.0, < 2.0)
28
- rspec-support (~> 3.7.0)
29
- rspec-mocks (3.7.0)
30
- diff-lcs (>= 1.2.0, < 2.0)
31
- rspec-support (~> 3.7.0)
32
- rspec-support (3.7.0)
33
- thin (1.7.2)
34
- daemons (~> 1.0, >= 1.0.9)
35
- eventmachine (~> 1.0, >= 1.0.4)
36
- rack (>= 1, < 3)
37
- websocket-driver (0.7.0)
38
- websocket-extensions (>= 0.1.0)
39
- websocket-extensions (0.1.3)
40
-
41
- PLATFORMS
42
- ruby
43
-
44
- DEPENDENCIES
45
- bundler (~> 1.14)
46
- drb-websocket!
47
- rake (~> 10.0)
48
- rspec (~> 3.0)
49
-
50
- BUNDLED WITH
51
- 1.16.1