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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98c2291071d88410d4cd20b5259fc61f4c7b7b16
4
- data.tar.gz: ad9a146bd8bc4692236a79804bb8690c1a9fbd35
3
+ metadata.gz: f442b357d8d3109b3f458a507fb4cb63b2f98c1a
4
+ data.tar.gz: 821cad8f51f7a7318d8695cb573e98f8612b9e35
5
5
  SHA512:
6
- metadata.gz: 94b49dc941ab5de47c65140c55152a5779fc0b3f25e76c8e5f5281085119164f0d37afc6eddedc33572f5b8099fa67e76db30743c4f4e81049b628354da07ae3
7
- data.tar.gz: 14098e0252d281539a9f090679fc625396f6203f5fa88899090aa443c76c0a35e43a9bb37c50ce95c2b986a6ea3ac6f82dc386d9f841a963ca12a065fad8df67
6
+ metadata.gz: d505d4335b2acc110e81d76f457c5b041a7db0ee8efe050fb4d6bcbe36dcdb597bf71471e3f73af99a8503ba5aaa6ac0aa94d739f5f2472f90859b79bd56cabf
7
+ data.tar.gz: df044150d53dbd0b0761d34a5421efbaf854d1483cfe8dc956683e048c5cb2b10ce7b0853897dd347ec50186c433e1138d4558f70bf39dd016d80371ea20310a
@@ -1,5 +1,5 @@
1
1
  module PeatioAPI
2
2
  class Client
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  require 'json'
2
2
  require 'eventmachine'
3
- require 'websocket-eventmachine-client'
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::EventMachine::Client.connect(uri: @endpoint)
16
+ ws = Faye::WebSocket::Client.new(@endpoint)
17
17
 
18
- ws.onopen do
18
+ ws.on(:open) do |event|
19
19
  @logger.info "Connected."
20
20
  end
21
21
 
22
- ws.onmessage do |payload, type|
23
- msg = JSON.parse(payload)
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.onclose do
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.2
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-03 00:00:00.000000000 Z
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-eventmachine-client
28
+ name: faye-websocket
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="