我想在這裏使用pusherapp,但是鉻的控制檯只是給了我「在連接建立之前WebSocket已關閉」。我的JS在下面,關於什麼可能是問題的任何想法?Pusherapp/Websocket未連接
<script type='text/javascript'>
$(document).ready(function(){
var pusher_key = "<%= Pusher.key %>";
var pusher_channel = "thirsty-<%= Rails.env %>";
var pusher = new Pusher(pusher_key, pusher_channel);
pusher.bind('push_comment', function(content) {
comment_html = '<li><p>' + content + '</p></li>'
$(comment_html).prependTo('#comments');
});
});
</script>
當你console.log「pusher_key」和「pusher_channel」的屬性是否正確? – Shakakai
是的,他們都顯示正確的值 –