celluloid-websocket-client 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1e9f6f5deeb9e546ed194dd5093e7ddfbdd39464
4
+ data.tar.gz: 5cbf81738edb85c3907741c0774ec51bcb375b74
5
+ SHA512:
6
+ metadata.gz: e3606c46c4cb91ee3dd4bad25d1195f54c6652c72d63866363e9ddea8e3ce61be96b23b8a3b3732052109ac7687a1583b26e27657706724079cc597a7401458f
7
+ data.tar.gz: a81bf5c7ac9bbe803afb8c11c763db78e3ddd7cc7566a901b7cdf128a7ad2b8cbe902e73ba90b3760b3d9f20e7500e4bf540fae0cd92f162425b9c4620552083
@@ -1,4 +1,4 @@
1
- require 'websocket/protocol'
1
+ require 'websocket/driver'
2
2
  require 'celluloid'
3
3
  require 'celluloid/io'
4
4
 
@@ -12,7 +12,7 @@ module Celluloid
12
12
  uri = URI.parse(url)
13
13
  port = uri.port || (uri.scheme == "ws" ? 80 : 443)
14
14
  @socket = Celluloid::IO::TCPSocket.new(uri.host, port)
15
- @client = ::WebSocket::Protocol.client(self)
15
+ @client = ::WebSocket::Driver.client(self)
16
16
  @handler = handler
17
17
 
18
18
  async.run
@@ -20,24 +20,28 @@ module Celluloid
20
20
  attr_reader :url
21
21
 
22
22
  def run
23
- @client.onopen do |event|
23
+ @client.on('open') do |event|
24
24
  @handler.async.on_open if @handler.respond_to?(:on_open)
25
25
  end
26
- @client.onmessage do |event|
26
+ @client.on('message') do |event|
27
27
  @handler.async.on_message(event.data) if @handler.respond_to?(:on_message)
28
28
  end
29
- @client.onclose do |event|
29
+ @client.on('close') do |event|
30
30
  @handler.async.on_close(event.code, event.reason) if @handler.respond_to?(:on_close)
31
31
  end
32
32
 
33
33
  @client.start
34
34
 
35
35
  loop do
36
- @client.parse(@socket.readpartial(1024))
36
+ begin
37
+ @client.parse(@socket.readpartial(1024))
38
+ rescue EOFError
39
+ break
40
+ end
37
41
  end
38
42
  end
39
43
 
40
- def_delegators :@client, :text
44
+ def_delegators :@client, :text, :binary, :ping, :close, :protocol
41
45
 
42
46
  def write(buffer)
43
47
  @socket.write buffer
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: celluloid-websocket-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jeremy Deininger
@@ -10,54 +9,48 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-04-22 00:00:00.000000000 Z
12
+ date: 2015-03-07 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
- name: websocket-protocol
15
+ name: websocket-driver
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ! '>='
18
+ - - ">="
21
19
  - !ruby/object:Gem::Version
22
20
  version: '0'
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
- - - ! '>='
25
+ - - ">="
29
26
  - !ruby/object:Gem::Version
30
27
  version: '0'
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: celluloid-io
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
- - - ! '>='
32
+ - - ">="
37
33
  - !ruby/object:Gem::Version
38
34
  version: '0'
39
35
  type: :runtime
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
- - - ! '>='
39
+ - - ">="
45
40
  - !ruby/object:Gem::Version
46
41
  version: '0'
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: pry
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
- - - ! '>='
46
+ - - ">="
53
47
  - !ruby/object:Gem::Version
54
48
  version: '0'
55
49
  type: :development
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
- - - ! '>='
53
+ - - ">="
61
54
  - !ruby/object:Gem::Version
62
55
  version: '0'
63
56
  description:
@@ -68,31 +61,29 @@ executables: []
68
61
  extensions: []
69
62
  extra_rdoc_files: []
70
63
  files:
71
- - lib/celluloid/websocket/client/connection.rb
72
64
  - lib/celluloid/websocket/client.rb
65
+ - lib/celluloid/websocket/client/connection.rb
73
66
  homepage:
74
67
  licenses: []
68
+ metadata: {}
75
69
  post_install_message:
76
70
  rdoc_options: []
77
71
  require_paths:
78
72
  - lib
79
73
  required_ruby_version: !ruby/object:Gem::Requirement
80
- none: false
81
74
  requirements:
82
- - - ! '>='
75
+ - - ">="
83
76
  - !ruby/object:Gem::Version
84
77
  version: '0'
85
78
  required_rubygems_version: !ruby/object:Gem::Requirement
86
- none: false
87
79
  requirements:
88
- - - ! '>='
80
+ - - ">="
89
81
  - !ruby/object:Gem::Version
90
82
  version: '0'
91
83
  requirements: []
92
84
  rubyforge_project:
93
- rubygems_version: 1.8.23
85
+ rubygems_version: 2.2.2
94
86
  signing_key:
95
- specification_version: 3
87
+ specification_version: 4
96
88
  summary: websocket client using celluloid-io
97
89
  test_files: []
98
- has_rdoc: