Parse.com无需客户端轮询即可通知客户端 [英] Parse.com Notify Clients Without Client Polling

查看:116
本文介绍了Parse.com无需客户端轮询即可通知客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在与Unity合作开发回合制游戏,并且正在使用Parse Unity SDK作为后端.

I am currently developing a turn-based game with Unity and I am using Parse Unity SDK as the backend.

到目前为止,刷新客户端的唯一方法是轮询服务器以查找更改.可以,但是我们正在考虑节省带宽.

So far the only way to refresh the client is to poll the server for changes. This works, but we are thinking of saving bandwidth.

我已经做过一些研究,到目前为止,这是我的初衷,但我一直在寻找更多选择,以查看是否有人对我们将如何做到这一点有更好的主意:

I have done some research over my side and so far here's what I have in mind but I was looking out for more options and seeing if anyone has a better idea on how we will go about doing this:

  1. 对云代码使用Parse推送通知,对客户端进行解析注册,然后在afterSave钩子中解析云代码,进行推送通知.但是,我已阅读推送通知,有时最多可能需要20分钟的延迟.
  2. 采用另一个外部服务,例如:pubnub,所有客户端都向pubnub注册.在解析云代码中的afterSave挂钩中,在pubnub中调用一个宁静的api广播给所有解析包含新数据的注册客户端,客户端只有在他们从pubnub接收到此类事件时才会轮询服务器.但是,我们真的很想看看是否可以仅使用parse来执行类似的操作.

任何建议和评论都值得赞赏.

Any suggestions and comments is appreciated.

推荐答案

您的想法是完全正确的.对于Parse而言,这根本不是工作.使用PubNub 或使用Firebase或类似产品-您的猜测是100%正确.

Your thought is perfectly correct. It's simply not a job for Parse. Use PubNub or perhaps Firebase or similar - your guess is 100% correct.

请注意,这里经常会问一个非常类似的问题:我可以使用解析和推送通知来创建聊天应用程序吗?"答案是不",这很愚蠢.当然,您需要实时连接.在过去"中,您只需编写一个永久连接的客户端-服务器系统. (没有什么不同,只是在您远程登录到服务器时.)如今,正如您所说的,请使用PubNub或类似的服务. (最终,您可以使用SmartFox或类似工具-但此处是答案是PubNub.)

Note that a very similar question is often asked on here: "Can I make a chat app using Parse and push notifications." The answer is just "no", it's silly. Of course you need a real-time connection. In the "old days", you'd just write a permanently connected client-server system. (Not unlike, simply when you telnet to a server.) Today, just as you say, use PubNub or a similar service. (Ultimately you could use SmartFox or the like - but PubNub is the answer here.)

{关于使用重复轮询来做到这一点,这真是愚蠢,算了!!

{Regarding doing it using repeated polling, that's just silly, forget it!}

如果您刚刚起步,请根据您的观点(2)来猜测如何做,不错的工作

If you're just starting out, nice work on guessing the way to do it in your point (2)

  • 顺便说一句,结合Parse和PubNub"上有许多文章,这正是您指出的原因.对于示例关于人们何时开始锻炼的早期记录.

  • BTW There are any number of articles around on "combining Parse and PubNub", for, exactly the sort of reason you point out. For example an early note on that when folks were just working it out.

此外,在我看来,Parse的所有者(即FB)尚未简单"引入Parse内部的PubNub,Pusher等功能,这确实让我感到很奇怪.他们为什么不这样做,真是太神秘了.

Further, it seems to me really strange that the owners of Parse, ie FB, have not yet "simply" incorported PubNub, Pusher, etc -like functionality, inside of, Parse. It's quite mysterious why they don't do this.

最后请注意,您提到了PubNub(这很了不起).对于您描述的示例问题,Pusher https://pusher.com 可能更令人惊讶"-不幸的是,我已经没有机会尝试.

Finally note that you mention PubNub (which is amazing). It's possible Pusher https://pusher.com is "even more amazing" for the example problem you describe - unfortunately I've not had a chance to try it.

这篇关于Parse.com无需客户端轮询即可通知客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆