Sha256: b7854587c21205b0aa0466c955ce77a3b6073c1390609713c0bf897a0de4e16a

Contents?: true

Size: 518 Bytes

Versions: 8

Compression:

Stored size: 518 Bytes

Contents

#!/usr/bin/env -S falcon serve --bind http://localhost:7070 --count 1 -c

require 'async/websocket/adapters/rack'
require 'set'

$connections = Set.new

run lambda {|env|
	Async::WebSocket::Adapters::Rack.open(env, protocols: ['ws']) do |connection|
		$connections << connection
		
		begin
			while message = connection.read
				$connections.each do |connection|
					connection.write(message)
					connection.flush
				end
			end
		ensure
			$connections.delete(connection)
		end
	end or [200, {}, ["Hello World"]]
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
async-websocket-0.14.0 spec/async/websocket/adapters/rack/config.ru
async-websocket-0.13.1 spec/async/websocket/adapters/rack/config.ru
async-websocket-0.13.0 spec/async/websocket/adapters/rack/config.ru
async-websocket-0.12.2 spec/async/websocket/adapters/rack/config.ru
async-websocket-0.12.1 spec/async/websocket/adapters/rack/config.ru
async-websocket-0.12.0 spec/async/websocket/adapters/rack/config.ru
async-websocket-0.11.1 spec/async/websocket/adapters/rack/config.ru
async-websocket-0.11.0 spec/async/websocket/adapters/rack/config.ru