Skip to content

Commit 660061d

Browse files
committed
Remove dependency on async-io.
1 parent bbd45e3 commit 660061d

File tree

7 files changed

+6
-29
lines changed

7 files changed

+6
-29
lines changed

async-websocket.gemspec

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Gem::Specification.new do |spec|
2525
spec.required_ruby_version = ">= 3.0"
2626

2727
spec.add_dependency "async-http", "~> 0.54"
28-
spec.add_dependency "async-io", "~> 1.23"
29-
spec.add_dependency "protocol-rack", "~> 0.1"
28+
spec.add_dependency "protocol-rack", "~> 0.5"
3029
spec.add_dependency "protocol-websocket", "~> 0.11"
3130
end

examples/chat/client.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# Copyright, 2018-2022, by Samuel Williams.
66

77
require 'async'
8-
require 'async/io/stream'
98
require 'async/http/endpoint'
109
require_relative '../../lib/async/websocket/client'
1110
require 'protocol/websocket/json_message'
@@ -15,13 +14,9 @@
1514
ENDPOINT = Async::HTTP::Endpoint.parse(URL)
1615

1716
Async do |task|
18-
stdin = Async::IO::Stream.new(
19-
Async::IO::Generic.new($stdin)
20-
)
21-
2217
Async::WebSocket::Client.connect(ENDPOINT) do |connection|
2318
input_task = task.async do
24-
while line = stdin.read_until("\n")
19+
while line = $stdin.gets
2520
message = Protocol::WebSocket::JSONMessage.generate({text: line})
2621
message.send(connection)
2722
connection.flush

examples/chat/multi-client.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
require 'async'
88
require 'async/semaphore'
99
require 'async/clock'
10-
require 'async/io/stream'
1110
require 'async/http/endpoint'
1211
require 'protocol/websocket/json_message'
1312
require_relative '../../lib/async/websocket/client'
@@ -28,7 +27,7 @@ class Command < Samovar::Command
2827

2928
def local_address
3029
if bind = @options[:bind]
31-
Async::IO::Address.tcp(bind, 0)
30+
Addrinfo.tcp(bind, 0)
3231
end
3332
end
3433

examples/mud/client.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,20 @@
66
# Copyright, 2020, by Juan Antonio Martín Lucas.
77

88
require 'async'
9-
require 'async/io/stream'
109
require 'async/http/endpoint'
1110
require 'async/websocket/client'
1211

1312
USER = ARGV.pop || "anonymous"
1413
URL = ARGV.pop || "http://127.0.0.1:7070"
1514

1615
Async do |task|
17-
stdin = Async::IO::Stream.new(
18-
Async::IO::Generic.new($stdin)
19-
)
20-
2116
endpoint = Async::HTTP::Endpoint.parse(URL)
2217

2318
Async::WebSocket::Client.connect(endpoint) do |connection|
2419
task.async do
2520
$stdout.write "> "
2621

27-
while line = stdin.read_until("\n")
22+
while line = $stdin.gets
2823
connection.write({input: line})
2924
connection.flush
3025

examples/polygon.io/client.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# Copyright, 2020-2022, by Samuel Williams.
66

77
require 'async'
8-
require 'async/io/stream'
98
require 'async/http/endpoint'
109

1110
require 'hexdump'

fixtures/rack_application/client.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,19 @@
55
# Copyright, 2018-2023, by Samuel Williams.
66

77
require 'async'
8-
require 'async/io/stream'
98
require 'async/http/endpoint'
109
require 'async/websocket/client'
1110

1211
USER = ARGV.pop || "anonymous"
1312
URL = ARGV.pop || "http://localhost:7070"
1413

1514
Async do |task|
16-
stdin = Async::IO::Stream.new(
17-
Async::IO::Generic.new($stdin)
18-
)
19-
2015
endpoint = Async::HTTP::Endpoint.parse(URL)
2116
headers = {'token' => 'wubalubadubdub'}
2217

2318
Async::WebSocket::Client.open(endpoint, headers: headers) do |connection|
2419
input_task = task.async do
25-
while line = stdin.read_until("\n")
20+
while line = $stdin.gets
2621
connection.write({user: USER, text: line})
2722
connection.flush
2823
end

guides/getting-started/readme.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,18 @@ $ bundle add async-websocket
2020
#!/usr/bin/env ruby
2121

2222
require 'async'
23-
require 'async/io/stream'
2423
require 'async/http/endpoint'
2524
require 'async/websocket/client'
2625

2726
USER = ARGV.pop || "anonymous"
2827
URL = ARGV.pop || "http://localhost:7070"
2928

3029
Async do |task|
31-
stdin = Async::IO::Stream.new(
32-
Async::IO::Generic.new($stdin)
33-
)
34-
3530
endpoint = Async::HTTP::Endpoint.parse(URL)
3631

3732
Async::WebSocket::Client.connect(endpoint) do |connection|
3833
input_task = task.async do
39-
while line = stdin.read_until("\n")
34+
while line = $stdin.gets
4035
connection.write({user: USER, text: line})
4136
connection.flush
4237
end

0 commit comments

Comments
 (0)