【发布时间】:2011-08-16 01:17:40
【问题描述】:
我在这里尝试使用 pusherapp,但 chromium 的控制台只是给了我“WebSocket 在建立连接之前已关闭”。我的 JS 在下面,关于可能是什么问题的任何想法?
<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”的属性是否正确?
-
是的,它们都显示了正确的值
标签: websocket