lib/logstash/outputs/websocket.rb in logstash-lite-0.2.20101124030048 vs lib/logstash/outputs/websocket.rb in logstash-lite-0.2.20101129155412
- old
+ new
@@ -9,13 +9,15 @@
def register
@channel = EventMachine::Channel.new
@subscribers = 0
host = (@url.host or "0.0.0.0")
port = (@url.port or 3000)
+ @logger.info("Registering websocket on #{@url}")
EventMachine::WebSocket.start(:host => host, :port => port) do |ws|
ws.onopen do
@subscribers += 1
+ @logger.info("New #{self.class.name} connection")
sid = @channel.subscribe do |msg|
ws.send msg
end
ws.onclose do
@channel.unsubscribe(sid)
@@ -27,9 +29,10 @@
def receive(event)
# Only publish the event to websockets if there are subscribers
# TODO(sissel): send a patch to eventmachine to fix this.
if @subscribers > 0
+ @logger.info("Sending event to websocket.")
@channel.push event.to_json
end
end # def event
end # class LogStash::Outputs::Websocket