Skip to content
Browse files

Adding Usher back solved the Websocket version not being able to send…

… data
  • Loading branch information...
1 parent 403da83 commit 52de0c068b2a890bbe4d219b17e9fa258ad95c91 @akitaonrails akitaonrails committed Jan 12, 2010
Showing with 7 additions and 6 deletions.
  1. +0 −1 README.textile
  2. +0 −1 app/controllers/chat_controller.rb
  3. +1 −0 chatserver.rb
  4. +6 −4 config/routes.rb
View
1 README.textile
@@ -57,7 +57,6 @@ The first URL will keep an open HTTP connection, receiving new messages as they
h2. Known Issues
-* In the WebSocket version, sending data is not returning the expected results
* In Firefox and Safari, I had the web-socket.js working properly, but for some reason it stopped working. Beware of flash blockers in your browser.
* In the Polling version it is manually setting the last message's timestamp in the URL. I was still now able to make a version using a Rack::Session
* Just because it is a proof-of-concept, it uses Rack::Static to serve the HTML and JS files, but it's not certain that this is the best way to do it
View
1 app/controllers/chat_controller.rb
@@ -12,7 +12,6 @@ def retrieve_messages
end
def receive_message(data)
- debugger
params = Rack::Utils.parse_query(data)
chat = Chat.new :name => params["from"],
View
1 chatserver.rb
@@ -1,5 +1,6 @@
require 'rubygems'
require 'thin'
+require 'usher'
require 'cramp/controller'
require 'cramp/model'
require 'active_support/all'
View
10 config/routes.rb
@@ -3,9 +3,11 @@ def app_routes
use Rack::Static, :urls => ["/public"]
use Rack::Session::Cookie
- map("/websocket") { run ChatController }
- map("/retrieve") { run RetrieveController }
- map("/receive") { run ReceiveController }
+ routes = Usher::Interface.for(:rack) do
+ get('/websocket').to(ChatController)
+ get('/retrieve').to(RetrieveController)
+ post('/receive').to(ReceiveController)
+ end
+ run routes
end
-
end

0 comments on commit 52de0c0

Please sign in to comment.
Something went wrong with that request. Please try again.