websocket-client-simple 0.2.1 → 0.2.2

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: 41d96bb780744bc9b24e6d9d906ec304a9512da0
4
- data.tar.gz: e75d9bb7d3e260404672b529bc66b949e2ed85ad
3
+ metadata.gz: 9b4e43f4364dbb6ced8350fa0da792cc7a2f6f87
4
+ data.tar.gz: 5312a46f3b77a301fdd7aa30d2dc4419b9090ec0
5
5
  SHA512:
6
- metadata.gz: 6645e615fe8583fe8858a8904eb69e51621fae5a1341b12902084fec49321c44a5904907b68e68190638fbf4bce8783504a68f94a9570d5b1c7b668a5c40dd19
7
- data.tar.gz: 9eec607a7ebefd55a4ab0d70cc8e4bdcefbcddf49a82a6e681851ec830016db3ae20110b208347119cf01e78674abfa37f62efd50f0d714f5238d75370804f9d
6
+ metadata.gz: 0ef747973068d4c96a560d81d7b962539f19e0c857965ae8fbaaf9ccaf50babeb9a2f2bcfc419906574b32b7ed7fc49e70ab99cfae311abbe34a4778b600e0ed
7
+ data.tar.gz: aa8b46b0a56891a845e3de9763f3758dc52a827986646ff3afb79ffb417c27f30deaf98586c41d50a071bbf147bf679053bd817a74017fcc8b5de2361c29fa33
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - '2.0.0'
4
3
  - '2.1.2'
5
4
  notifications:
6
5
  slack:
@@ -1,3 +1,8 @@
1
+ === 0.2.2 2014-11-18
2
+
3
+ * add :ssl_version option to specify version of SSL/TLS
4
+ * thank you for contributing @tonybyrne
5
+
1
6
  === 0.2.1 2014-10-19
2
7
 
3
8
  * bugfix socket reading
@@ -2,21 +2,23 @@ module WebSocket
2
2
  module Client
3
3
  module Simple
4
4
 
5
- def self.connect(url)
6
- ::WebSocket::Client::Simple::Client.new url
5
+ def self.connect(url, options={})
6
+ ::WebSocket::Client::Simple::Client.new(url, options)
7
7
  end
8
8
 
9
9
  class Client
10
10
  include EventEmitter
11
11
  attr_reader :url, :handshake
12
12
 
13
- def initialize(url)
13
+ def initialize(url, options={})
14
14
  @url = url
15
15
  uri = URI.parse url
16
16
  @socket = TCPSocket.new(uri.host,
17
17
  uri.port || (uri.scheme == 'wss' ? 443 : 80))
18
18
  if ['https', 'wss'].include? uri.scheme
19
- @socket = ::OpenSSL::SSL::SSLSocket.new(@socket)
19
+ ctx = OpenSSL::SSL::SSLContext.new
20
+ ctx.ssl_version = options[:ssl_version] || 'SSLv23'
21
+ @socket = ::OpenSSL::SSL::SSLSocket.new(@socket, ctx)
20
22
  @socket.connect
21
23
  end
22
24
  @handshake = ::WebSocket::Handshake::Client.new :url => url
@@ -1,7 +1,7 @@
1
1
  module WebSocket
2
2
  module Client
3
3
  module Simple
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
6
6
  end
7
7
  end
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'eventmachine'
3
- require 'em-websocket'
3
+ require 'websocket-eventmachine-server'
4
4
 
5
5
  PORT = (ARGV.shift || 8080).to_i
6
6
 
@@ -8,7 +8,8 @@ EM::run do
8
8
  @channel = EM::Channel.new
9
9
 
10
10
  puts "start websocket server - port:#{PORT}"
11
- EM::WebSocket.start(:host => "0.0.0.0", :port => PORT) do |ws|
11
+
12
+ WebSocket::EventMachine::Server.start(:host => "0.0.0.0", :port => PORT) do |ws|
12
13
  ws.onopen do
13
14
  sid = @channel.subscribe do |mes|
14
15
  ws.send mes
@@ -3,6 +3,6 @@ require 'bundler'
3
3
  require 'minitest/autorun'
4
4
  require 'websocket-client-simple'
5
5
  require 'eventmachine'
6
- require 'em-websocket'
6
+ require 'websocket-eventmachine-server'
7
7
 
8
8
  $:.unshift File.expand_path '../lib', File.dirname(__FILE__)
@@ -15,7 +15,7 @@ class TestWebSocketClientSimple < MiniTest::Test
15
15
  @channel = EM::Channel.new
16
16
 
17
17
  ## echo server
18
- EM::WebSocket.start(:host => "0.0.0.0", :port => port) do |ws|
18
+ WebSocket::EventMachine::Server.start(:host => "0.0.0.0", :port => port) do |ws|
19
19
  ws.onopen do
20
20
  sid = @channel.subscribe do |mes|
21
21
  ws.send mes
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.add_development_dependency "bundler", "~> 1.3"
21
21
  spec.add_development_dependency "rake"
22
22
  spec.add_development_dependency "minitest"
23
- spec.add_development_dependency "em-websocket"
23
+ spec.add_development_dependency "websocket-eventmachine-server"
24
24
  spec.add_development_dependency "eventmachine"
25
25
 
26
26
  spec.add_dependency "websocket"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: websocket-client-simple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Hashimoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-19 00:00:00.000000000 Z
11
+ date: 2014-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: em-websocket
56
+ name: websocket-eventmachine-server
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="