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 +4 -4
- data/.travis.yml +0 -1
- data/History.txt +5 -0
- data/lib/websocket-client-simple/client.rb +6 -4
- data/lib/websocket-client-simple/version.rb +1 -1
- data/sample/echo_server.rb +3 -2
- data/test/test_helper.rb +1 -1
- data/test/test_websocket_client_simple.rb +1 -1
- data/websocket-client-simple.gemspec +1 -1
- 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: 9b4e43f4364dbb6ced8350fa0da792cc7a2f6f87
|
4
|
+
data.tar.gz: 5312a46f3b77a301fdd7aa30d2dc4419b9090ec0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ef747973068d4c96a560d81d7b962539f19e0c857965ae8fbaaf9ccaf50babeb9a2f2bcfc419906574b32b7ed7fc49e70ab99cfae311abbe34a4778b600e0ed
|
7
|
+
data.tar.gz: aa8b46b0a56891a845e3de9763f3758dc52a827986646ff3afb79ffb417c27f30deaf98586c41d50a071bbf147bf679053bd817a74017fcc8b5de2361c29fa33
|
data/.travis.yml
CHANGED
data/History.txt
CHANGED
@@ -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
|
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
|
-
|
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
|
data/sample/echo_server.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'eventmachine'
|
3
|
-
require '
|
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
|
-
|
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
|
data/test/test_helper.rb
CHANGED
@@ -15,7 +15,7 @@ class TestWebSocketClientSimple < MiniTest::Test
|
|
15
15
|
@channel = EM::Channel.new
|
16
16
|
|
17
17
|
## echo server
|
18
|
-
|
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 "
|
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.
|
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-
|
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:
|
56
|
+
name: websocket-eventmachine-server
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|