我在这里尝试使用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>
发布于 2018-06-04 02:41:41
如果互联网连接太慢,或者检查推流器Credentials.
https://stackoverflow.com/questions/7072609
复制相似问题