Skip to content

Commit

Permalink
Fix WebSockets example.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Aug 26, 2024
1 parent 05a59bf commit b364b30
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/websockets/config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ require 'async/websocket/adapters/rack'
class App
def call(env)
Async::WebSocket::Adapters::Rack.open(env) do |connection|
message = Protocol::WebSocket::TextMessage.generate({body: "Hello World"})

while true
connection.write({message: "Hello World"})
connection.write(message)
connection.flush

# This is still needed for Ruby 2.7+ but is not needed in Ruby 3+
Async::Task.current.sleep 1
sleep 1
end
end
end
Expand Down
92 changes: 92 additions & 0 deletions examples/websockets/gems.locked
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
PATH
remote: ../..
specs:
falcon (0.47.8)
async
async-container (~> 0.18)
async-http (~> 0.66, >= 0.66.3)
async-http-cache (~> 0.4.0)
async-service (~> 0.10)
bundler
localhost (~> 1.1)
openssl (~> 3.0)
process-metrics (~> 0.2.0)
protocol-rack (~> 0.5)
samovar (~> 2.3)

GEM
remote: https://rubygems.org/
specs:
async (2.16.0)
console (~> 1.26)
fiber-annotation
io-event (~> 1.6, >= 1.6.5)
async-container (0.18.2)
async (~> 2.10)
async-http (0.70.0)
async (>= 2.10.2)
async-pool (~> 0.7)
io-endpoint (~> 0.11)
io-stream (~> 0.4)
protocol-http (~> 0.28)
protocol-http1 (~> 0.19)
protocol-http2 (~> 0.18)
traces (>= 0.10)
async-http-cache (0.4.4)
async-http (~> 0.56)
async-pool (0.8.0)
async (>= 1.25)
async-service (0.12.0)
async
async-container (~> 0.16)
async-websocket (0.28.0)
async-http (~> 0.54)
protocol-http (>= 0.28.1)
protocol-rack (~> 0.5)
protocol-websocket (~> 0.15)
console (1.27.0)
fiber-annotation
fiber-local (~> 1.1)
json
fiber-annotation (0.2.0)
fiber-local (1.1.0)
fiber-storage
fiber-storage (1.0.0)
io-endpoint (0.13.0)
io-event (1.6.5)
io-stream (0.4.0)
json (2.7.2)
localhost (1.3.1)
mapping (1.1.1)
openssl (3.2.0)
process-metrics (0.2.1)
console (~> 1.8)
samovar (~> 2.1)
protocol-hpack (1.5.0)
protocol-http (0.28.2)
protocol-http1 (0.19.1)
protocol-http (~> 0.22)
protocol-http2 (0.18.0)
protocol-hpack (~> 1.4)
protocol-http (~> 0.18)
protocol-rack (0.6.0)
protocol-http (~> 0.23)
rack (>= 1.0)
protocol-websocket (0.15.0)
protocol-http (~> 0.2)
rack (3.1.7)
samovar (2.3.0)
console (~> 1.0)
mapping (~> 1.0)
traces (0.13.1)

PLATFORMS
ruby
x86_64-linux

DEPENDENCIES
async-websocket
falcon!

BUNDLED WITH
2.5.16

0 comments on commit b364b30

Please sign in to comment.