- update doc comments

- remove auth attempts since the WebSocket api doesn't support
  authentication (lol)
This commit is contained in:
Jordan Sissel 2012-11-27 01:05:42 -08:00
parent f3c336ecdf
commit 334a26628a
2 changed files with 6 additions and 17 deletions

View file

@ -1,7 +1,12 @@
require "logstash/namespace"
require "logstash/outputs/base"
# TODO(sissel): THIS IS NOT SUPPORTED IN JRUBY YET
# This output runs a websocket server and publishes any
# messages to all connected websocket clients.
#
# You can connect to it with ws://<host>:<port>/
#
# If no clients are connected, any messages received are ignored.
class LogStash::Outputs::WebSocket < LogStash::Outputs::Base
config_name "websocket"
plugin_status "experimental"

View file

@ -12,23 +12,7 @@ class LogStash::Outputs::WebSocket::App < Sinatra::Base
set :reload_templates, false
helpers do
def protected!
unless authorized?
response['WWW-Authenticate'] = %(Basic realm="Restricted Area")
throw(:halt, [401, "Not authorized\n"])
end
end
def authorized?
auth = Rack::Auth::Basic::Request.new(request.env)
auth.provided? && auth.basic? && auth.credentials && auth.credentials == ['admin', 'admin']
end
end
get "/" do
protected!
# TODO(sissel): Support filters/etc.
ws = ::FTW::WebSocket::Rack.new(env)
@logger.debug("New websocket client")