update README
[sunshowers.git] / t / echo.ru
blob047ba6651f7f8a7b17d00b172f5eb157b0bc4e02
1 #\-E deployment
3 # This is designed to run against:
4 #   http://pywebsocket.googlecode.com/svn/trunk/src/example/echo_client@139
6 require 'sunshowers'
7 use Rack::ContentLength
8 use Rack::ContentType
9 run lambda { |env|
10   req = Sunshowers::Request.new(env)
11   if req.ws?
12     req.ws_handshake!
13     ws_io = req.ws_io
14     ws_io.each do |record|
15       ws_io.write(record)
16       break if record == "Goodbye"
17     end
18     req.ws_quit! # Rainbows! should handle this quietly
19   end
20   [404, {}, []]