wamp_client 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -0
- data/lib/wamp/client/transport/base.rb +4 -0
- data/lib/wamp/client/transport/event_machine_base.rb +4 -0
- data/lib/wamp/client/version.rb +1 -1
- data/spec/wamp/client/transport_spec.rb +12 -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: 22086142dd8573b78491561c8f332d8e536250cf
|
4
|
+
data.tar.gz: f9d9182d4b29904e87d4b1aaf9626de3bb80eea5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02ef5205e5f30a9fed3b8307eb52eacfe0f37b9829995d9132efdddeb4154ed13fc26e2e15153383257fa0dd33c4b1145db661627e96f45ecbed273d5dc6f329
|
7
|
+
data.tar.gz: 8b634eb7e49a67b4305b9e986994aad836dbb0145f1b0eebe2c1d169beb66747e10cec77db2c8a10c9a8816480cd225ee924c027b2c2eaf0d743e217921fbe89
|
data/README.md
CHANGED
@@ -10,6 +10,8 @@ Please use [wamp_rails](https://github.com/ericchapman/ruby_wamp_rails) to integ
|
|
10
10
|
|
11
11
|
## Revision History
|
12
12
|
|
13
|
+
- v0.1.1:
|
14
|
+
- Added 'add_tick_loop' method to the transport to abstract the event machine
|
13
15
|
- v0.1.0:
|
14
16
|
- BREAKING CHANGE - Changed all of the namespaces to be "Wamp::Client"
|
15
17
|
- v0.0.9:
|
@@ -147,6 +149,26 @@ connection.on(:challenge) do |authmethod, extra|
|
|
147
149
|
end
|
148
150
|
```
|
149
151
|
|
152
|
+
#### Event Tick
|
153
|
+
You can run a task on every event machine tick by using the transport class
|
154
|
+
method 'add_tick_loop'
|
155
|
+
|
156
|
+
```ruby
|
157
|
+
require 'wamp/client'
|
158
|
+
|
159
|
+
options = {
|
160
|
+
uri: 'ws://127.0.0.1:8080/ws',
|
161
|
+
realm: 'realm1',
|
162
|
+
}
|
163
|
+
|
164
|
+
connection = Wamp::Client::Connection.new(options)
|
165
|
+
|
166
|
+
connection.transport_class.add_tick_loop do
|
167
|
+
# Do something periodic
|
168
|
+
end
|
169
|
+
|
170
|
+
```
|
171
|
+
|
150
172
|
#### Overriding Transport
|
151
173
|
By default, the library will use the "websocket-eventmachine-client" Gem as the websocket transport.
|
152
174
|
However the library also supports overriding this.
|
data/lib/wamp/client/version.rb
CHANGED
@@ -17,6 +17,18 @@ describe Wamp::Client::Transport do
|
|
17
17
|
expect(value).to eq(10)
|
18
18
|
end
|
19
19
|
|
20
|
+
it '#add_tick_loop' do
|
21
|
+
value = 0
|
22
|
+
described_class.start_event_machine do
|
23
|
+
described_class.add_tick_loop do
|
24
|
+
value += 1
|
25
|
+
described_class.stop_event_machine if value == 10
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
expect(value).to eq(10)
|
30
|
+
end
|
31
|
+
|
20
32
|
context '#add_timer' do
|
21
33
|
include RSpec::EM::FakeClock
|
22
34
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wamp_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Chapman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|