litecable 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/README.md +1 -1
- data/examples/sinatra/Gemfile +2 -2
- data/examples/sinatra/chat.rb +1 -1
- data/examples/sinatra/views/room.slim +1 -1
- data/lib/lite_cable/connection/subscriptions.rb +1 -1
- data/lib/lite_cable/server/client_socket/base.rb +2 -0
- data/lib/lite_cable/server/middleware.rb +4 -4
- data/lib/lite_cable/version.rb +1 -1
- data/litecable.gemspec +1 -1
- metadata +4 -5
- data/lib/lite_cable/server/websocket_ext/protocols.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4cd86a9f6cb1636c77ec87485b61050eaffade5
|
4
|
+
data.tar.gz: d602270a3b4e9f8e57744a226219743a6e71c510
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5959fb92c1c91a96f94f06c94af4a6ee27f6958c9b4690a4bb28091a37c5ba464534e5d5f1480c7d80e68694fbf112db3f6803d5a514ad867b98cbccbc1ba779
|
7
|
+
data.tar.gz: 7d5aec25eaf3fadc7a210b10bcd1d6797e0329d58dcf80ee1dbf552d85aa8a4f2c01be8b3699b4cc3e4252c2bf77915b847936169cf13401695667192916488c
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![Gem Version](https://badge.fury.io/rb/litecable.svg)](https://rubygems.org/gems/litecable) [![Build Status](https://travis-ci.org/
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/litecable.svg)](https://rubygems.org/gems/litecable) [![Build Status](https://travis-ci.org/palkan/litecable.svg?branch=master)](https://travis-ci.org/palkan/litecable) [![Circle CI](https://circleci.com/gh/palkan/litecable/tree/master.svg?style=svg)](https://circleci.com/gh/palkan/litecable/tree/master)
|
2
2
|
|
3
3
|
# Lite Cable
|
4
4
|
|
data/examples/sinatra/Gemfile
CHANGED
data/examples/sinatra/chat.rb
CHANGED
@@ -113,6 +113,8 @@ module LiteCable
|
|
113
113
|
frame = WebSocket::Frame::Outgoing::Server.new(version: version, type: :close, code: 1000)
|
114
114
|
@socket.write(frame.to_s) if frame.supported?
|
115
115
|
@socket.close
|
116
|
+
rescue IOError, Errno::EPIPE, Errno::ETIMEDOUT # rubocop:disable Lint/HandleExceptions
|
117
|
+
# already closed
|
116
118
|
end
|
117
119
|
|
118
120
|
def keepalive
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module LiteCable
|
3
3
|
module Server
|
4
|
-
require "lite_cable/server/websocket_ext/protocols"
|
5
4
|
# Rack middleware to hijack the socket
|
6
5
|
class Middleware
|
7
6
|
class HijackNotAvailable < RuntimeError; end
|
@@ -30,10 +29,11 @@ module LiteCable
|
|
30
29
|
private
|
31
30
|
|
32
31
|
def send_handshake(env)
|
33
|
-
handshake = WebSocket::Handshake::Server.new
|
34
|
-
|
35
|
-
|
32
|
+
handshake = WebSocket::Handshake::Server.new(
|
33
|
+
protocols: LiteCable::INTERNAL[:protocols]
|
34
|
+
)
|
36
35
|
|
36
|
+
handshake.from_rack env
|
37
37
|
env['rack.hijack_io'].write handshake.to_s
|
38
38
|
handshake
|
39
39
|
end
|
data/lib/lite_cable/version.rb
CHANGED
data/litecable.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_dependency "anyway_config", "~>0.5.0"
|
21
21
|
|
22
22
|
spec.add_development_dependency "rack", "~> 2.0"
|
23
|
-
spec.add_development_dependency "websocket", "~> 1.2.
|
23
|
+
spec.add_development_dependency "websocket", "~> 1.2.4"
|
24
24
|
spec.add_development_dependency "websocket-client-simple", "~> 0.3.0"
|
25
25
|
spec.add_development_dependency "concurrent-ruby", "~> 1.0.0"
|
26
26
|
spec.add_development_dependency "puma", "~> 3.6.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: litecable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- palkan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: anyway_config
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.2.
|
47
|
+
version: 1.2.4
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.2.
|
54
|
+
version: 1.2.4
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: websocket-client-simple
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -225,7 +225,6 @@ files:
|
|
225
225
|
- lib/lite_cable/server/heart_beat.rb
|
226
226
|
- lib/lite_cable/server/middleware.rb
|
227
227
|
- lib/lite_cable/server/subscribers_map.rb
|
228
|
-
- lib/lite_cable/server/websocket_ext/protocols.rb
|
229
228
|
- lib/lite_cable/version.rb
|
230
229
|
- lib/litecable.rb
|
231
230
|
- litecable.gemspec
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# Add missing protocols support to websocket-ruby
|
3
|
-
module WebSocketExt
|
4
|
-
module Protocols # :nodoc:
|
5
|
-
module Handshake # :nodoc:
|
6
|
-
# Specify server protocols
|
7
|
-
def protocols(values)
|
8
|
-
@protocols = values
|
9
|
-
end
|
10
|
-
|
11
|
-
# Return matching protocol
|
12
|
-
def protocol
|
13
|
-
return @protocol if instance_variable_defined?(:@protocol)
|
14
|
-
protos = @headers['sec-websocket-protocol']
|
15
|
-
|
16
|
-
return @protocol = nil unless protos
|
17
|
-
@protocol = begin
|
18
|
-
protos = protos.split(/ *, */) if protos.is_a?(String)
|
19
|
-
protos.find { |p| @protocols.include?(p) }
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
module Handler # :nodoc:
|
25
|
-
def handshake_keys
|
26
|
-
return super unless @handshake.protocol
|
27
|
-
super + [
|
28
|
-
[
|
29
|
-
'Sec-WebSocket-Protocol',
|
30
|
-
@handshake.protocol
|
31
|
-
]
|
32
|
-
]
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
WebSocket::Handshake::Server.include WebSocketExt::Protocols::Handshake
|
39
|
-
[
|
40
|
-
WebSocket::Handshake::Handler::Server04,
|
41
|
-
WebSocket::Handshake::Handler::Server75,
|
42
|
-
WebSocket::Handshake::Handler::Server76
|
43
|
-
].each do |handler|
|
44
|
-
handler.prepend WebSocketExt::Protocols::Handler
|
45
|
-
end
|