Skip to content

Commit

Permalink
Drop usage of JSONMessage.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Jul 3, 2024
1 parent 3c7f964 commit f226399
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/live/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
require 'async'
require 'async/queue'

require 'protocol/websocket/json_message'
require 'protocol/websocket'

module Live
# Represents a connected client page with bound dynamic content areas.
Expand Down Expand Up @@ -95,15 +95,15 @@ def run(connection)
while update = @updates.dequeue
Console.debug(self, "Sending update:", update)

connection.write(::Protocol::WebSocket::JSONMessage.generate(update))
connection.write(::Protocol::WebSocket::Message.generate(update))
connection.flush if @updates.empty?
end
end

while message = connection.read
Console.debug(self, "Reading message:", message)

if json_message = ::Protocol::WebSocket::JSONMessage.wrap(message)
if message = ::Protocol::WebSocket::Message.wrap(message)
process_message(json_message.parse)
else
Console.warn(self, "Unhandled message:", message)
Expand Down
2 changes: 1 addition & 1 deletion live.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = ">= 3.1"

spec.add_dependency "async-websocket", "~> 0.23"
spec.add_dependency "async-websocket", "~> 0.26"
spec.add_dependency "xrb"
end

0 comments on commit f226399

Please sign in to comment.