<commit_before>require "rubygems"
require "bundler"
Bundler.setup(:default, :example)

require 'cramp'
require 'http_router'
require 'active_support/json'

class TimeController < Cramp::SSE
  on_start :send_latest_time
  periodic_timer :send_latest_time, :every => 25

  def send_latest_time
    data = {'time' => Time.now.to_i}.to_json

    # render data, :retry => 10
    render data
  end
end

routes = HttpRouter.new do
  add('/sse').to(TimeController)
end

file_server = Rack::File.new(File.join(File.dirname(__FILE__), 'public'))

# bundle exec rainbows -E deployment -c examples/sse/rainbows.conf examples/sse/server.ru
run Rack::Cascade.new([file_server, routes])
<commit_msg>Use thin in comments<commit_after>require "rubygems"
require "bundler"
Bundler.setup(:default, :example)

require 'cramp'
require 'http_router'
require 'active_support/json'

class TimeController < Cramp::SSE
  on_start :send_latest_time
  periodic_timer :send_latest_time, :every => 2

  def send_latest_time
    data = {'time' => Time.now.to_i}.to_json

    # render data, :retry => 10
    render data
  end
end

routes = HttpRouter.new do
  add('/sse').to(TimeController)
end

file_server = Rack::File.new(File.join(File.dirname(__FILE__), 'public'))

# bundle exec thin -R examples/sse/server.ru start
run Rack::Cascade.new([file_server, routes])

{'fraction_non_alphanumeric': 0.1258426966292135, 'fraction_numerical': 0.0052434456928838954, 'mean_word_length': 5.072727272727272, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3356782', 'n_tokens_mistral': 476, 'n_tokens_neox': 465, 'n_words': 107}