live 0.11.0 → 0.12.0

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
  SHA256:
3
- metadata.gz: 41876a4b4870415b70d8e5747dce78f8eeed867b524bad32b9a0146c56296f41
4
- data.tar.gz: ba656166a150f8d5a2da0ce37bc358159eb082db4b6340ef751cc2ff3b9f00d1
3
+ metadata.gz: b389272cf70f88ade8e987e6df962c0e73761d738d7fc15e29134a6d3677f072
4
+ data.tar.gz: adebf021e1a94bed6fd09a4c90364f3176873fcbfb0b691005262a7095768927
5
5
  SHA512:
6
- metadata.gz: 39d76c89db7212a85596ef74630816a88107fc752ac8e932f76b43d5e2d943bbb4e631f4a78a44b7c9e4c6ef2095defce9c5d8da83f9334f171afe20d9a41ad6
7
- data.tar.gz: 86484b279c0a6c16f4d46fe2220627ba35a74810413108377bf4f8002c84c95681bea4f1d7c760842b48bdc10e5c5c7cecdc9e3c7723700df3f415e51256d1f4
6
+ metadata.gz: 8f36c200788c094e7662f14dad854db15b5bfe2e04c96e4bf546e2821be91eef549eb574a872476db632e2a6d00cbbe3e3670954756d5b801364d06cfa627809
7
+ data.tar.gz: ac325892c144ae36d6417990f76271016782cb196a8cbb7d59645a14a4868804bdd2f61a813de2cff14a8053912115bb1e64961a0ea937023a7ea0ff04d6848e
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/live/page.rb CHANGED
@@ -9,7 +9,8 @@ require_relative 'resolver'
9
9
  require 'async'
10
10
  require 'async/queue'
11
11
 
12
- require 'protocol/websocket/json_message'
12
+ require 'protocol/websocket'
13
+ require 'protocol/websocket/message'
13
14
 
14
15
  module Live
15
16
  # Represents a connected client page with bound dynamic content areas.
@@ -91,27 +92,23 @@ module Live
91
92
  # Run the event handling loop with the given websocket connection.
92
93
  # @parameter connection [Async::WebSocket::Connection]
93
94
  def run(connection)
94
- queue_task = Async do
95
- while update = @updates.dequeue
96
- Console.debug(self, "Sending update:", update)
97
-
98
- connection.write(::Protocol::WebSocket::JSONMessage.generate(update))
99
- connection.flush if @updates.empty?
95
+ Sync do |task|
96
+ queue_task = task.async do
97
+ while update = @updates.dequeue
98
+ Console.debug(self, "Sending update:", update)
99
+ ::Protocol::WebSocket::TextMessage.generate(update).send(connection)
100
+ connection.flush if @updates.empty?
101
+ end
100
102
  end
101
- end
102
-
103
- while message = connection.read
104
- Console.debug(self, "Reading message:", message)
105
103
 
106
- if json_message = ::Protocol::WebSocket::JSONMessage.wrap(message)
107
- process_message(json_message.parse)
108
- else
109
- Console.warn(self, "Unhandled message:", message)
104
+ while message = connection.read
105
+ Console.debug(self, "Reading message:", message)
106
+ process_message(message.parse)
110
107
  end
108
+ ensure
109
+ self.close
110
+ queue_task&.stop
111
111
  end
112
- ensure
113
- self.close
114
- queue_task&.stop
115
112
  end
116
113
  end
117
- end
114
+ end
data/lib/live/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2021-2024, by Samuel Williams.
5
5
 
6
6
  module Live
7
- VERSION = "0.11.0"
7
+ VERSION = "0.12.0"
8
8
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: live
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -38,7 +38,7 @@ cert_chain:
38
38
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
39
39
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
40
40
  -----END CERTIFICATE-----
41
- date: 2024-05-12 00:00:00.000000000 Z
41
+ date: 2024-07-03 00:00:00.000000000 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: async-websocket
@@ -46,14 +46,14 @@ dependencies:
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '0.23'
49
+ version: '0.27'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '0.23'
56
+ version: '0.27'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: xrb
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubygems_version: 3.5.3
106
+ rubygems_version: 3.5.11
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: Live HTML tags updated via a WebSocket.
metadata.gz.sig CHANGED
Binary file