Skip to content

Instantly share code, notes, and snippets.

@digitalextremist
Created April 5, 2013 02:41
Show Gist options
  • Save digitalextremist/5316190 to your computer and use it in GitHub Desktop.
Save digitalextremist/5316190 to your computer and use it in GitHub Desktop.
Sample Reel server, to cause reproducible error.
require 'rubygems'
require 'bundler/setup'
require 'reel'
class MyServer < Reel::Server
def initialize(host = "0.0.0.0", port = 80)
super(host, port, &method(:on_connection))
end
def on_connection(connection)
while request = connection.request
case request
when Reel::Request
handle_request(request)
when Reel::WebSocket
handle_websocket(request)
end
end
end
def handle_request(request)
request.respond :ok, "Hello, world!"
end
def handle_websocket(sock)
sock << "Hello everyone out there in WebSocket land!"
sock.close
end
end
MyServer.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment