Google Channel API - 如何在本地测试?
我想测试我的应用程序,该应用程序使用 google 通道 api 在两个用户之间共享消息,但我设法看到消息仅从一侧传输到另一侧。 是因为我在同一台机器上打开2个通道吗?我在不同的浏览器(Chrome 和 IE)上运行该应用程序,并且每个浏览器都使用不同的用户名登录?这还不够吗?
关于如何在一台 PC 上测试我的应用程序,或者我必须为此类应用程序连接另一台 PC,有什么建议吗?
谢谢 穆基。
I want to test my application which share messages between two users using google channel api, but I manage to see messages going only from one side to the other.
is it because I'm opening 2 channels on the same machine? I am running the application on different browsers (Chrome and IE) and each one logged in with a different user name? shouldn't that be enough?
Any suggestion on how to test my application on a single PC, or must I connect another PC for such application?
Thanks
Muky.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您当然可以在单台机器上测试 Google Channel API。 (我已经做到了,它有效)。请注意,当我在本地计算机上运行它时,我看到浏览器发出连续的请求(轮询),但当我将其上传到 Google App Engine 时,我只看到推送通知。 (您可以使用 Firefox 中的 Firebug 查看请求 - 在 NET 选项卡中)。据我了解,Channel API 是使用轮询在本地模式下模拟的,而当上传到 Google App Engine 时,它们使用 Comet(不是轮询,而是长期请求)。
我认为您的情况不是浏览器问题。每个登录用户应该打开一个频道。然后,当您想向每个用户发送消息时,您应该向每个登录的 ID 发送一条消息。
You surely can test Google Channel API on a single machine. (I've done it, it works). Note that, when I run it on my local machine, I see the browser makes continuous requests (polling) although, when I upload it to Google App Engine, I only see push notifications. (You can check out the requests using Firebug in Firefox - in the NET tab). As far as I understand, Channel API is simulated in local mode using polling whereas, when uploaded to Google App Engine, they make use of Comet (not polling, rather long-lived requests).
I don't think your case was a browser issue. Each logged in user should open one channel. Then when you want to send a message to every users, you should send a message to each id that's logged in.