The connection to ws://localhost:9292/faye was interrupted while the page was loading

On the client side in Firebug in Firefox I see error

The connection to ws://localhost:9292/faye was interrupted while the page was loading

here is my application.js file:

$(function() {
    var faye = new Faye.Client('http://localhost:9292/faye');
    alert("connected.");
    faye.subscribe("/game/poker", function(data) {
        eval(data);
    });
});

And here is my erb.js file:

<%= broadcast "/game/poker" do %>
<% @allowed && @user_hand && @game.table.size == 5 && @game.hasler == @game.user.name ? cc = @game.combo_cards(@user_hand) : cc = [1, 2, 3, 4, 5] %>
$("#table").empty().append("<div class='player-cards'>" + "<%= escape_javascript render :partial => "table_cards", :locals => {:cards => @game.table, :combo_cards => cc} %>" + "</div");
$("#deck-size").empty().append("<div class='deck-size'>" + <%= escape_javascript "#{@game.deck.size}" %> +"</div>");
$("#<%= @game.user.name %>_action").empty().append("<%= escape_javascript "#{@game.user.actions.last}" %>");
$("#<%= @game.bot.name %>_action").empty().append("<%= escape_javascript "#{@game.bot.actions.last}" %>");

<% unless @allowed && (@game.bot.moved && @game.user.moved) || @pfold == true %>
    $("#deal").hide();
<% end %>
<% if @game.to_call != 0 %>
    $("#check").hide();
    $("#call").show();
<% else %>
    $("#call").hide();
    $("#check").show();
<% end %>
<% unless !@pfold && !@allowed %>
    $("#fold").hide();
    $("#bet").hide();
    $("#small2").hide();
    $("#small4").hide();
    $("#small8").hide();
    $("#all_in").hide();
<% end %>
<% end %>

The problem is that nothing inside broadcast block works. browser response is simply empty. The broadcast method is same as in railscast:

def broadcast(channel, &block)
    @action = {:channel => channel, :data => capture(&block)}
    @uri = URI.parse("http://localhost:9292/faye")
    Net::HTTP.post_form(@uri, :action => @action.to_json)
    puts "DEBUG::broadcasting channel"
end

What I'm doing wrong? Please help anything you can.

Base on your code, I assume that you do not use the websocket. Try this on your application.js, this might work. Let me know

$(function() {
    var faye = new Faye.Client('http://localhost:9292/faye');
    alert("connected.");
    faye.subscribe("/game/poker", function(data) {
       eval(data);
    });

    faye.disable('websocket');

});