examples/chat/server.rb in async-io-1.18.2 vs examples/chat/server.rb in async-io-1.18.3
- old
+ new
@@ -2,11 +2,11 @@
$LOAD_PATH << File.expand_path("../../lib", __dir__)
require 'set'
-require 'async/reactor'
+require 'async'
require 'async/io/host_endpoint'
require 'async/io/protocol/line'
class User < Async::IO::Protocol::Line
attr_accessor :name
@@ -59,10 +59,10 @@
broadcast("#{user} has disconnected: #{reason}")
end
def run(endpoint)
- Async::Reactor.run do |task|
+ Async do |task|
endpoint.accept do |peer|
stream = Async::IO::Stream.new(peer)
user = User.new(stream)
@users << user