Skip to content

Instantly share code, notes, and snippets.

@maksadbek
Created August 21, 2013 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maksadbek/6291539 to your computer and use it in GitHub Desktop.
Save maksadbek/6291539 to your computer and use it in GitHub Desktop.
class MessagingController < ApplicationController
  include ActionController::Live
 
  def send_message
    response.headers['Content-Type'] = 'text/event-stream'
    10.times {
      response.stream.write "This is a test Messagen"
      sleep 1
    }
    response.stream.close
  end
end
----------------------------------------------------------
<%= form_tag messaging_path, :method => 'get' do %>
 
    <%= text_field_tag :message, params[:message] %>
    <%= submit_tag "Post Message" %>
 
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment