litecable 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47a04414eade53832c4b900305ca3a034999724c0cabd6aceacb908192a6124f
4
- data.tar.gz: 24c67d2cacbb5f64b5b7d63293c7fdbe143797d0102b732983fc78028469dfc9
3
+ metadata.gz: 94ece0fdf218bcdeefe8b375d73114c28bd869c5d232d1c38dd91f0e880c1e57
4
+ data.tar.gz: e53c002d7179a52793a1382dd88dbb782d43319801e0f5ff51d36dd32237c005
5
5
  SHA512:
6
- metadata.gz: eb63ada090f884f750828b7c116d1066a020c87ab043d929e4ad46b035299c95972acf1d458813a34da797273e0656fc7613977cfef24c6e0765a7a8dece9a6a
7
- data.tar.gz: 75314e320e2ed5f18e34c4038d467aef14e73f9b0e4fe01f61955369a52ee28e246e62662a94c3e1d1b9f7ea9999049f8d58e5f7af80479fc88a97b91055720e
6
+ metadata.gz: 1867f388377ea2f29c63cea936e255dcea9b7011ce83a45f93965ee98507c00e063360d62fb436a80a767c52b23f00ff853e92dbb93421ab9b0f007243cbc1d7
7
+ data.tar.gz: 9d344ce7aa7f3f0c07dc8c6be396cd51ae18758ffd5ad3e07ff156704fe87ee4ab0d54c67f0e619b30cb5344635f39860df0919b6a9587230ae87aa7d226d0c7
@@ -1,5 +1,11 @@
1
1
  # Change log
2
2
 
3
+ ## master (unreleased)
4
+
5
+ ## 0.7.1 (2021-01-06)
6
+
7
+ - Fix handling client disconnection during socket write. ([@palkan][])
8
+
3
9
  ## 0.7.0 (2020-01-07)
4
10
 
5
11
  - Refactor AnyCable integration ([@palkan][])
@@ -39,8 +39,8 @@ module LiteCable # :nodoc:
39
39
  false
40
40
  end
41
41
  rescue LiteCable::Connection::Subscriptions::Error,
42
- LiteCable::Channel::Error,
43
- LiteCable::Channel::Registry::Error => e
42
+ LiteCable::Channel::Error,
43
+ LiteCable::Channel::Registry::Error => e
44
44
  log(:error, log_fmt("Connection command failed: #{e}"))
45
45
  close
46
46
  false
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LiteCable
4
- # rubocop:disable Metrics/LineLength
5
4
  module Channel
6
5
  class Error < StandardError; end
6
+
7
7
  class RejectedError < Error; end
8
+
8
9
  class UnproccessableActionError < Error; end
9
10
 
10
11
  # The channel provides the basic structure of grouping behavior into logical units when communicating over the connection.
@@ -63,7 +64,6 @@ module LiteCable
63
64
  # client-side, the <tt>Channel#rejected</tt> callback will get invoked when
64
65
  # the server rejects the subscription request.
65
66
  class Base
66
- # rubocop:enable Metrics/LineLength
67
67
  class << self
68
68
  # A set of method names that should be considered actions.
69
69
  # This includes all public instance methods on a channel except from Channel::Base methods.
@@ -5,7 +5,9 @@ module LiteCable
5
5
  # Stores channels identifiers and corresponding classes.
6
6
  module Registry
7
7
  class Error < StandardError; end
8
+
8
9
  class AlreadyRegisteredError < Error; end
10
+
9
11
  class UnknownChannelError < Error; end
10
12
 
11
13
  class << self
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LiteCable
4
- # rubocop:disable Metrics/LineLength
5
4
  module Channel
6
5
  # Streams allow channels to route broadcastings to the subscriber. A broadcasting is a pubsub queue where any data
7
6
  # placed into it is automatically sent to the clients that are connected at that time.
@@ -29,7 +28,6 @@ module LiteCable
29
28
  #
30
29
  # You can stop streaming from all broadcasts by calling #stop_all_streams or use #stop_from to stop streaming broadcasts from the specified stream.
31
30
  module Streams
32
- # rubocop:enable Metrics/LineLength
33
31
  def handle_unsubscribe
34
32
  stop_all_streams
35
33
  super
@@ -9,7 +9,7 @@ module LiteCable
9
9
  val
10
10
  end
11
11
 
12
- alias encode decode
12
+ alias_method :encode, :decode
13
13
  end
14
14
  end
15
15
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LiteCable
4
- # rubocop:disable Metrics/LineLength
5
4
  module Connection
6
5
  # A Connection object represents a client "connected" to the application.
7
6
  # It contains all of the channel subscriptions. Incoming messages are then routed to these channel subscriptions
@@ -38,7 +37,6 @@ module LiteCable
38
37
  # it easy to use cookies that were set when logging in via a web interface to authorize the connection.
39
38
  #
40
39
  class Base
41
- # rubocop:enable Metrics/LineLength
42
40
  include Authorization
43
41
  prepend Identification
44
42
  include Logging
@@ -5,8 +5,11 @@ module LiteCable
5
5
  # Manage the connection channels and route messages
6
6
  class Subscriptions
7
7
  class Error < StandardError; end
8
+
8
9
  class AlreadySubscribedError < Error; end
10
+
9
11
  class UnknownCommandError < Error; end
12
+
10
13
  class ChannelNotFoundError < Error; end
11
14
 
12
15
  include Logging
@@ -13,7 +13,7 @@ module LiteCable
13
13
  @logger = LiteCable.config.logger
14
14
  return if @logger == false
15
15
 
16
- @logger ||= ::Logger.new(STDERR).tap do |logger|
16
+ @logger ||= ::Logger.new($stderr).tap do |logger|
17
17
  logger.level = LiteCable.config.log_level
18
18
  end
19
19
  end
@@ -36,6 +36,9 @@ module LiteCable
36
36
  type: type
37
37
  )
38
38
  socket.write frame.to_s
39
+ rescue EOFError, Errno::ECONNRESET => e
40
+ log(:debug, "Socket gone: #{e}")
41
+ close
39
42
  rescue IOError, Errno::EPIPE, Errno::ETIMEDOUT => e
40
43
  log(:error, "Socket send failed: #{e}")
41
44
  close
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LiteCable
4
- VERSION = "0.7.0"
4
+ VERSION = "0.7.1"
5
5
  end
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.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-30 00:00:00.000000000 Z
11
+ date: 2021-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: anyway_config
@@ -124,46 +124,18 @@ dependencies:
124
124
  version: '10.0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rspec
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '3.0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '3.0'
139
- - !ruby/object:Gem::Dependency
140
- name: simplecov
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
129
  - - ">="
144
130
  - !ruby/object:Gem::Version
145
- version: 0.3.8
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: 0.3.8
153
- - !ruby/object:Gem::Dependency
154
- name: pry-byebug
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
131
+ version: '3.0'
160
132
  type: :development
161
133
  prerelease: false
162
134
  version_requirements: !ruby/object:Gem::Requirement
163
135
  requirements:
164
136
  - - ">="
165
137
  - !ruby/object:Gem::Version
166
- version: '0'
138
+ version: '3.0'
167
139
  description: Fat-free ActionCable implementation for using with AnyCable (and without
168
140
  Rails)
169
141
  email: