peatio_client 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/peatio_api/client/version.rb +1 -1
- data/lib/peatio_api/streaming_client.rb +8 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f442b357d8d3109b3f458a507fb4cb63b2f98c1a
|
4
|
+
data.tar.gz: 821cad8f51f7a7318d8695cb573e98f8612b9e35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d505d4335b2acc110e81d76f457c5b041a7db0ee8efe050fb4d6bcbe36dcdb597bf71471e3f73af99a8503ba5aaa6ac0aa94d739f5f2472f90859b79bd56cabf
|
7
|
+
data.tar.gz: df044150d53dbd0b0761d34a5421efbaf854d1483cfe8dc956683e048c5cb2b10ce7b0853897dd347ec50186c433e1138d4558f70bf39dd016d80371ea20310a
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'eventmachine'
|
3
|
-
require 'websocket
|
3
|
+
require 'faye/websocket'
|
4
4
|
|
5
5
|
module PeatioAPI
|
6
6
|
class StreamingClient < Client
|
@@ -13,14 +13,14 @@ module PeatioAPI
|
|
13
13
|
|
14
14
|
def run(&callback)
|
15
15
|
EM.run do
|
16
|
-
ws = WebSocket::
|
16
|
+
ws = Faye::WebSocket::Client.new(@endpoint)
|
17
17
|
|
18
|
-
ws.
|
18
|
+
ws.on(:open) do |event|
|
19
19
|
@logger.info "Connected."
|
20
20
|
end
|
21
21
|
|
22
|
-
ws.
|
23
|
-
msg = JSON.parse(
|
22
|
+
ws.on(:message) do |event|
|
23
|
+
msg = JSON.parse(event.data)
|
24
24
|
|
25
25
|
key = msg.keys.first
|
26
26
|
data = msg[key]
|
@@ -37,8 +37,9 @@ module PeatioAPI
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
ws.
|
41
|
-
@logger.info "Closed."
|
40
|
+
ws.on(:close) do |event|
|
41
|
+
@logger.info "Closed. Code: #{event.code}, Reason: #{event.reason || 'none'}"
|
42
|
+
ws = nil
|
42
43
|
EM.stop
|
43
44
|
end
|
44
45
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peatio_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peatio Opensource
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: websocket
|
28
|
+
name: faye-websocket
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|