alphapoint 0.1.3.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/alphapoint/version.rb +1 -1
- data/lib/alphapoint/web_socket.rb +23 -28
- 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: '09e77eeb428adcace775fee560501e75b6bf0a03'
|
4
|
+
data.tar.gz: ed91a7aa8fbd25275b1b1a669822874d6555ce40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e24eecce4bdc07a0fdb5fca3d0a11cac27cc5cc71e9d73f2a15bdba013a52f6855e7f225aef2a0f7ec9bc10e267f0642bc4e442f1595b81a25933e6d3458c09d
|
7
|
+
data.tar.gz: 3bdf5fe82795726f10130caf4c03df6225f1ae4cb70d6cb2dcfb64770040f8945dfca25532aaadb640df3d25a718407ba4fa1fd942fe65eaf8502416ff456472
|
data/lib/alphapoint/version.rb
CHANGED
@@ -6,7 +6,7 @@ module Alphapoint
|
|
6
6
|
|
7
7
|
attr_accessor :address
|
8
8
|
|
9
|
-
def
|
9
|
+
def initialize(address = nil, &block)
|
10
10
|
if Alphapoint.configuration.nil? ||
|
11
11
|
Alphapoint.configuration.address.nil? ||
|
12
12
|
Alphapoint.configuration.address.empty?
|
@@ -31,38 +31,32 @@ module Alphapoint
|
|
31
31
|
|
32
32
|
alpha_self = self
|
33
33
|
|
34
|
-
@thread = Thread.new do
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
54
|
-
end
|
34
|
+
@thread = Thread.new do
|
35
|
+
EM.run do
|
36
|
+
@ws = Faye::WebSocket::Client.new(@address)
|
37
|
+
@ws.on :open do |event|
|
38
|
+
p [:open, "Websocket connected to #{@address}"]
|
39
|
+
end
|
40
|
+
|
41
|
+
@ws.on :message do |event|
|
42
|
+
alpha_self.delegate_message(JSON.parse(event.data).with_indifferent_access)
|
43
|
+
end
|
44
|
+
|
45
|
+
@ws.on :error do |event|
|
46
|
+
p [:error, event.inspect]
|
47
|
+
end
|
48
|
+
|
49
|
+
@ws.on :close do |event|
|
50
|
+
p [:close, event.code, event.reason]
|
51
|
+
end
|
52
|
+
end
|
55
53
|
end
|
56
54
|
|
57
|
-
p @thread.status
|
58
|
-
|
59
55
|
trap(:INT) { EM.stop }
|
60
56
|
trap(:TERM){ EM.stop }
|
61
57
|
|
62
58
|
while not EM.reactor_running?; end
|
63
|
-
|
64
|
-
|
65
|
-
self
|
59
|
+
while not EM.defers_finished?; end
|
66
60
|
end
|
67
61
|
|
68
62
|
def build_request(function_name, payload,type = 0, &block)
|
@@ -75,7 +69,6 @@ module Alphapoint
|
|
75
69
|
|
76
70
|
@response[@nextIValue] = block
|
77
71
|
@nextIValue += 2
|
78
|
-
|
79
72
|
@ws.send(JSON.generate(frame))
|
80
73
|
end
|
81
74
|
|
@@ -100,6 +93,8 @@ module Alphapoint
|
|
100
93
|
end
|
101
94
|
|
102
95
|
def method_missing(m, *args, &block)
|
96
|
+
# to wait handshake finish
|
97
|
+
sleep(0.5)
|
103
98
|
function_name = m.to_s.camelcase
|
104
99
|
respond_action = @avaliable_functions.select{ |func| func == function_name }
|
105
100
|
if respond_action.size > 0
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alphapoint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabiano Martins
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-01-
|
13
|
+
date: 2019-01-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|