1
를로드하는 동안 9292/페이는 내가 볼 중단 된 오류WS에 연결 : // localhost를 : 페이지가 파이어 폭스에서 파이어 버그에서 클라이언트 측에서
여기The connection to ws://localhost:9292/faye was interrupted while the page was loading
내 application.js 파일은 다음과 같습니다
<%= 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 [email protected] && [email protected] %>
$("#fold").hide();
$("#bet").hide();
$("#small2").hide();
$("#small4").hide();
$("#small8").hide();
$("#all_in").hide();
<% end %>
<% end %>
문제는 브로드 캐스트 블록 작품 내부에 아무것도 :
$(function() {
var faye = new Faye.Client('http://localhost:9292/faye');
alert("connected.");
faye.subscribe("/game/poker", function(data) {
eval(data);
});
});
그리고 여기 내 erb.js 파일입니다. 브라우저 응답은 단순히 비어 있습니다. 방송 방법은 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
? 가능한 한 무엇이든 도와주세요.
방송 이후에 faye로부터 응답을 받으시겠습니까? 먼저 브로드 캐스트의 모든 내용을 간단한 'alert()'로 바꾸고 브로드 캐스트의 ': data'를 하드 코드로 바꿔서 문제를 격리 할 수 있는지 확인합니다. –