-
Notifications
You must be signed in to change notification settings - Fork 4
Home
gavit edited this page Sep 13, 2010
·
21 revisions
You can visit their website for instructions 1
You can visit their website for the latest2 instructions
- Download ez_setup.py
- python ez_setup.py setuptools
- easy_install orbited
- If you will use an external stomp server, download the orbited.cfg
- gem install stomp
- cd YOUR_APP && script/plugin install git://github.com/mallio/orbited
- cd YOUR_APP && script/sever
- /usr/local/bin/orbited —config=config/orbited.cfg
- If you chose to use an external stomp server, start the external stomp server
class MyController < ApplicationController
def add_line
data = render_to_string :update do |page|
page["#chat-window"].append params[:entry]
end
Orbited.send_data('hello', data) #TODO test if this works
end
end
Assuming you use JQuery.
form_remote_tag #TODO replace with JQuery code
content_for(:head){ <%= orbited_javascript %> #TODO Shouldn't need to include prototype when using JQuery <%= stomp_connect('hello', :onerror => 'errorHandler', :onclose => 'function(){alert("closed!")}', :js => :jquery, :callbacks => {:onmessageframe => "function(frame) { alert('Recv: '+ frame.body); eval(frame.body); }"} ) %> }
<%- form_remote_tag :url => {:controller => ‘participants’, :action => :add_line}, :method => :put do
>end -%>
<= text_field_tag ‘entry’ >
<= submit_tag (‘Say’) >
<
map.resources :MyController, :collection => { :add_line => :put}