File: eof.rb

package info (click to toggle)
ruby-excon 0.112.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,232 kB
  • sloc: ruby: 7,855; makefile: 5
file content (17 lines) | stat: -rwxr-xr-x 259 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env ruby

require "eventmachine"

module EOFServer
  def receive_data(data)
    case data
    when %r{^GET /eof\s}
      close_connection(true)
    end
  end
end

EM.run do
  EM.start_server("127.0.0.1", 9292, EOFServer)
  $stderr.puts "ready"
end