require 'sinatra/base' require 'rack/handler/puma' require 'sinatra/hijacker' class App < Sinatra::Base register Sinatra::Hijacker get '/' do index_html end websocket '/ws' do ws.onmessage do |msg| ws.send_data "Hello, #{msg}" end end helpers do def index_html <<-EOS
EOS end end end Rack::Handler::Puma.run App