Sha256: b4be606556574a954bcf64c42b2caad980c09f6ff1a58c1ce25021cbab997e86
Contents?: true
Size: 521 Bytes
Versions: 4
Compression:
Stored size: 521 Bytes
Contents
prepend Actions require 'async/websocket/adapters/rack' require 'set' $connections = Set.new on 'connect' do |request| response = Async::WebSocket::Adapters::Rack.open(request.env) do |connection| $connections << connection while message = connection.read $connections.each do |connection| puts "Server sending message: #{message.inspect}" connection.write(message) end end ensure $connections.delete(connection) end Async.logger.info(self, request, response) respond?(response) end
Version data entries
4 entries across 4 versions & 1 rubygems