Skip to content

Instantly share code, notes, and snippets.

View yura's full-sized avatar

Yuriy Kotlyarov yura

View GitHub Profile
@yura
yura / chat.rb
Created December 17, 2011 13:34 — forked from rkh/chat.rb
Simple Chat Application using the Sinatra Streaming API
# coding: utf-8
require 'sinatra'
set server: 'thin', connections: []
get '/' do
halt erb(:login) unless params[:user]
erb :chat, locals: { user: params[:user].gsub(/\W/, '') }
end
get '/stream', provides: 'text/event-stream' do