小编Pra*_*ran的帖子

如果用户在卸载后立即再次安装app,GCM是否会删除旧的注册ID?

我发现当GCM无法发送下一个推送通知时,GCM会将注册ID标记为删除.

但在我的情况下,我的用户发生了以下情况.

场景:

1)我的用户安装了应用程序,他的设备已在GCM注册.

2)同一用户卸载并立即再次安装应用程序.第二次生成新的注册ID.

3)这两个注册ID存储在我的数据库中.

4)现在这个特定用户正在获得两个推送通知.

现在我有以下问题:

问题:

  1. GCM会在一段时间后删除旧的注册ID吗?
  2. 请建议我如何处理这种情况?

android push-notification google-cloud-messaging

6
推荐指数
1
解决办法
5925
查看次数

如何使用代理跳转(堡垒主机)通过ssh隧道连接到mongodb服务器

我有一个像这样的 ssh 配置文件。我有一个从 test2 到 host1 的代理跳转。

Host host1
  Hostname xxxxxx.us-east-1.elb.amazonaws.com
  Port 2222
  User xxxx
  IdentityFile ~/.ssh/cert
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  KeepAlive yes
  ServerAliveInterval 30
  ServerAliveCountMax 30

Host test2
  Hostname xx.xxx.xx.xxx
  ProxyCommand  ssh.exe host1  -q -W %h:%p host1
  User ubuntu
  IdentityFile ~/.ssh/cert
  KeepAlive yes
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  ServerAliveInterval 30
  ServerAliveCountMax 30
Run Code Online (Sandbox Code Playgroud)

我的 mongo 数据库主机:xxx-nonprod.cluster-xx.us-east-1.docdb.amazonaws.com

我必须使用 Host test2使用 SSH 隧道连接到 Mongodb ,但它使用ProxyCommand进行代理跳转

我想使用 SSH 隧道与Mongo DB Compass以及Node js mongoose连接到 mongodb 。

如何使用 Mongo DB Compass …

mongoose mongodb ssh-tunnel mongodb-compass bastion-host

5
推荐指数
1
解决办法
6909
查看次数

卸载应用程序时,GCM未取消注册设备

我做了一个Android应用程序.我用GCM推送通知.我在用户登录时使用GCM注册设备.我使用外部MySql数据库来存储用户的注册ID.它工作正常.

当我执行以下步骤时:

  1. 在我的手机中安装了我的应用.
  2. 使用user1登录.
  3. 从我的手机上卸载了应用程序.
  4. 再次安装应用程序.
  5. 使用user2登录.

仍然在我的手机中收到user1通知,这意味着在卸载应用程序时GCM 没有取消注册我的设备.

卸载应用程序时,我无法删除Mysql数据库中的行,因为在卸载应用程序删除行时,我不知道应用程序何时被卸载或用户可能没有互联网连接.

你能建议我如何解决这个问题吗?

我读过GCM在卸载后需要一些时间来取消注册设备.

当GCM取消注册设备时,如何删除mysql中的行?

android push-notification google-cloud-messaging

4
推荐指数
1
解决办法
2170
查看次数

当刷新页面或按下 F5 时,服务器发送事件,而循环需要太多时间来加载页面

我正在使用服务器发送的事件来查询数据库中的新记录并向用户显示事件

这是我的代码

javascript

window.onload = function setDataSource() {

if (!!window.EventSource) {
var source = new EventSource("polling.php");

source.addEventListener("message", function(e) {
  console.log(e.data);
}, false);

source.addEventListener("open", function(e) {
  console.log("OPENED");
}, false);

source.addEventListener("error", function(e) {
  console.log(e);
  if (e.readyState == EventSource.CLOSED) {
    console.log("CLOSED");
  }
}, false); } else {}}
Run Code Online (Sandbox Code Playgroud)

PHP

  <?php
  header("Content-Type: text/event-stream\n\n");
  include_once dirname(__FILE__) . '/db.php';
  session_start();

   while (1) {
   $response = getnewmessages();
   echo 'data: Message '. json_encode1($response)."\n\n";
   ob_flush();
   flush();
   sleep(5);

   }

 function getnewmessages ()
{
// query database and get new records.
 } …
Run Code Online (Sandbox Code Playgroud)

php server-sent-events

3
推荐指数
1
解决办法
1382
查看次数