Skip to content

Instantly share code, notes, and snippets.

@ngarneau
ngarneau / chat.rb
Created Dec 14, 2011 — forked from rkh/chat.rb
Simple Chat Application using the Sinatra Streaming API
View chat.rb
# 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
You can’t perform that action at this time.