Skip to content

Commit

Permalink
remove faye handler
Browse files Browse the repository at this point in the history
I realized it's a bad idea because pubsub doesn't distinguish
between different clients and sessions. Everytime that the faye
handler was opened, it would publish to every other connected client
rather than just the requesting client.

Down the line, I might explore adding a pubsub interface to rack-stream,
but it's out of scope for now.
  • Loading branch information
Jerry Cheung committed May 25, 2012
1 parent ed7b959 commit ca5a2e4
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 107 deletions.
1 change: 0 additions & 1 deletion Gemfile
Expand Up @@ -23,7 +23,6 @@ group :development, :test do
gem 'em-eventsource'
gem 'em-http-request'
gem 'sinatra'
gem 'faye'
end

# debugger for 1.9 only
Expand Down
80 changes: 0 additions & 80 deletions lib/rack/stream/handlers/faye.rb

This file was deleted.

3 changes: 0 additions & 3 deletions spec/integration/server_spec.rb
Expand Up @@ -10,7 +10,6 @@
require 'em-eventsource'
require 'capybara'
require 'capybara-webkit'
require 'faye'

describe 'Integration', :integration => true, :type => :request, :driver => :webkit do
EXPECTED = 'HELLO WORLDCHUNKYMONKEYBROWNIEBATTERCLOSING'.freeze
Expand Down Expand Up @@ -73,8 +72,6 @@
all('#ws li').map(&:text).should =~ ["socket opened", "HELLO", "", "WORLD", "CHUNKY", "MONKEY", "BROWNIE", "BATTER", "CLOSING", "socket closed"]

all('#es li').map(&:text).should =~ ["HELLO", "", "WORLD", "CHUNKY", "MONKEY", "BROWNIE", "BATTER", "CLOSING"]

all('#faye li').map(&:text).should =~ ["HELLO", "", "WORLD", "CHUNKY", "MONKEY", "BROWNIE", "BATTER", "CLOSING", "stream unsubscribed"]
end
end
end
Expand Down
3 changes: 0 additions & 3 deletions spec/integration/sinatra.ru
@@ -1,9 +1,6 @@
require 'sinatra/base'
require 'rack/stream'
require 'faye'
require 'rack/stream/handlers/faye'

use Faye::RackAdapter, :mount => '/faye', :timeout => 5
use Rack::Stream

class App < Sinatra::Base
Expand Down
20 changes: 0 additions & 20 deletions spec/integration/views/index.erb
Expand Up @@ -2,8 +2,6 @@
<head></head>
<body>
<h1>Rack::Stream Sinatra Example</h1>
<h2>Faye</h2>
<ul id='faye'></ul>

<h2>Websocket</h2>
<ul id='ws'></ul>
Expand All @@ -12,7 +10,6 @@
<ul id='es'></ul>

<script type='text/javascript' src='/jquery-1.7.2.min.js'></script>
<script type='text/javascript' src='/faye.js'></script>
<script type='text/javascript'>
$(function() {
var socket, source, faye;
Expand All @@ -34,23 +31,6 @@
source.addEventListener('message', function(e) {
es(e.data);
});

faye = new Faye.Client('http://localhost:8888/faye');
var subscription = faye.subscribe('/stream', function(message) {
f(message);
});
faye.subscribe('/stream/close', function(message) {
subscription.cancel();
f("stream unsubscribed");
});
subscription.callback(function() {
$.ajax({
url: '/',
headers: {
'X-FAYE-STREAM': '/stream'
}
});
});
})
</script>
</body>
Expand Down

0 comments on commit ca5a2e4

Please sign in to comment.