问题标签 [private-pub]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
92 浏览

javascript - 如果动作没有形式,那么在rails中响应js很热吗?

我尝试制作通知系统并遇到问题

我需要通过以下方式向视图发布通知:track_activity.js.erb

和我的带有动作跟踪活动的 application_controller

每次当其他用户创建这样的东西时,我都会使用这种方法

注释控制器.rb

每次rails调用track_activity动作时如何附加track_activity.js.erb?track_activity 操作中的 respond_to 无济于事

0 投票
1 回答
770 浏览

ruby-on-rails - private_pub gem rails 和 https 错误

我已经在生产环境中使用 private_pub 一年多了,最近我刚刚将应用程序从 http 移动到 https。我们已经安装了签名证书,并且应用程序中的所有其他内容都在运行,但是当我 private_pub/thin 提交任何要推送的内容时,我收到以下错误。

我无法找到与此错误和 private_pub/thin 相关的任何具体内容,但我看到的其他问题与 sunspot/solr在需要127.0.0.1时指向localhost相关。我的 private_pub 配置正在使用实际的https://domain.com

我的应用程序能够连接到 faye.js,但出现上面的服务器错误。

private_pub_thin.yml:

private_pub.yml:

private_pub.ru:

任何想法将不胜感激。先感谢您

- - 编辑 - -

我没有提到这一点,但我确实在服务器的 iptables 上打开了端口 4443,我什至尝试完全关闭 iptables 进行测试。仍然有同样的错误

0 投票
1 回答
501 浏览

ruby-on-rails - Rails gem Private_Pub facebook like 聊天实现

我正在尝试使用 private_pub gem 实现一种 Facebook 聊天,但遇到以下问题:

假设有两个人登录了应用程序 user1 和 user2。user1 向 user2 发送消息;但是 user2 不会收到该消息,除非他订阅了会话频道,这仅在 user2 想要向 user1 发送消息(打开聊天窗口)时发生。

在 user1 发送消息时将 user2 订阅到频道的最佳方式是什么(甚至有可能?)如果这是不可能的,那么实现此目的的最佳方式是什么。我现在能想到的一件事是在页面加载时为 user2 订阅频道,但我想如果我们有太多可以相互交谈的用户,那将不是一件好事。

谢谢您的帮助!

0 投票
0 回答
731 浏览

ruby - 查找用户在线状态

我正在使用private_pub 1.0.3 gem它构建在我的本地主机之上faye并能够在我的本地主机中使用它。现在我想使用这个 gem 实现检查用户在线状态是在线还是离线的功能。

我对网络套接字完全陌生,发现 private_pub 很容易配置它,所以实现了它.....但是现在我陷入了上述问题。所以,请让我知道什么是正确的解决方案。

我发现这个教程http://www.ryanepp.com/blog/how-do-i-tell-if-a-user-is-online我认为这可以解决我的问题....我已经配置了 redis 服务器并通过控制台对其进行了测试,一切正常......现在我要做的就是用我们自己的gem替换websocket-rails部分代码。private_pub

更新

我发现了这些faye事件:

但是,我如何使用private_pubgem来使用和绑定这些事件

新更新

我已经在 githubfaye-railsprivate_pubgem 中打开了问题,请访问他们,我已经为问题做了部分解决方案,但这并没有完全解决我的问题

私人酒吧问题 110

faye-rails 问题 72

谢谢

0 投票
1 回答
106 浏览

javascript - Private_pub console.log 不起作用

为什么不能在 publish_to 调用中使用 console.log?

create.js.erb:

0 投票
1 回答
164 浏览

apache - 生产中的private_pub“签名不正确”问题

我正在使用 private_pub gem 在我的应用程序中实现实时聊天。现在,虽然这在登台上工作得很好,但我无法让它在生产中工作。两台服务器都是带有 Ubuntu 操作系统的 Amazon Ec2 实例。

在生产中,当我点击包含subscribe_to方法的页面时出现错误。虽然 faye.js 的服务很好。

浏览器控制台中的错误是:"error":"Incorrect signature."

我还RAILS_ENV=production bundle exec rackup private_pub.ru -s thin -E production按照其中一个问题中的建议添加了内容。

生产和登台都具有完全相同的 apache 配置和打开的端口,但登台使用 ufw 防火墙除外。还有什么需要做的吗?

我在 apache 的 httpd conf 中使用这个 proxypass 设置。

此外,apache 和应用程序日志中没有错误。

0 投票
1 回答
1783 浏览

mysql - Unread messages counter

I am creating a simple chatting app on rails 4. The controllers, models and views are created but the functionality is still incomplete. I have 2 tables in my database, conversations and messages. The conversation table holds two fields, sender id and receiver id. And the messages table holds 3 fields, body, user id and read(defaults to 0 meaning not read).

Models:

What I am trying to do is to create a real-time functionality of receiving unread messages count whenever someone receives a new message. I am using private pub to create the chat between users.

I have a user model which contains this function:

I have one page where all user's conversations are listed and one a conversation is clicked all the messages related to that conversation are listed too. On the same page I have subscribed every conversation_messages_path to create separate channels for every conversation. Whenever a message is sent a create.js.erb file is rendered where I publish to those subscribed channels:

The $("#conversation_link") is where I want to show the unread messages count.

Currently, the unread messages count is returning back the wrong count and the navbar is only updated when the conversation.sender_id messages the receiver.

My unread message counter is not returning the correct number of unread messages. I don't know how to fix it. What's wrong in my code? Thanks.

0 投票
1 回答
504 浏览

ruby-on-rails - error installing private pub on live server in rails 4

I am using private pub for one of my projects. Its working fine on localhost but when I deploy it on live server it giving following error:

Errno::ECONNREFUSED in CommentsController#new

Connection refused - connect(2) for "202.164.34.20" port 9292

Here is my private_pub.yml file content for local server:

and for other server, here is the file content:

Now I need to deploy this on http://202.164.34.20:3001 url. please suggest.

0 投票
1 回答
207 浏览

ruby-on-rails-4 - 如何使用 private_pub 将 Rails 应用程序部署到 heroku

我正在尝试在使用 private_pub gem 的 heroku 上运行我的应用程序。在我的本地服务器中,我完美地运行它。我怎样才能在heroku中推送这个应用程序并在那里完美运行。这是我的宝石文件:

这是我的 private_pub.yml 文件:

如何在 heroku 中推送此应用程序帮助我将其推送到 herok 上。

0 投票
1 回答
1234 浏览

ruby-on-rails - 对带有配置文件的瘦服务器使用 rackup 命令

我正在尝试运行以下命令来在生产环境中运行服务器:

private_pub.ru 看起来像这样:

我想将配置文件(thin.yml)传递给 Thin,如下所示:

所以这是我要执行的命令:

但是 rackup 不支持 -C 因为这个参数是针对瘦的......根据这些文档:https ://github.com/macournoyer/thin/#configuration-files

我还尝试将我的命令更改为:

但后来我得到错误:

在我的设置中 - 当机架运行很薄时,如何将此配置(thin.yml)传递给瘦?