使用 AppEngine Channel API 同步多个窗口/选项卡上的聊天

发布于 2024-10-17 02:46:21 字数 481 浏览 9 评论 0原文

我正在 Google AppEngine Channel API 之上开发一个聊天应用程序,其中一个挑战是在多个窗口/选项卡(在单个浏览器中)中运行时协调/同步聊天。

特别是,如果用户在一个窗口/选项卡中打开一个对话,然后打开一个连接到我的网站的新窗口/选项卡,我希望同一对话出现在新窗口/选项卡中(这是功能Facebook 聊天和其他网站都有)。我相信这可以通过为用户打开的每个窗口打开一个新通道并让服务器确保每个通道具有最新的对话数据来实现,但我担心会达到限制(如果有一个)关于 Channel API 允许的通道数量 - 我也担心这种方法的效率。

所以,我的问题是:1)从效率/效果的角度来看,为单个用户的每个窗口/选项卡打开一个新通道是否有意义? 2) 我可以向单个用户打开的频道数量是否有任何限制? 3) 我可以打开的频道数量有总体限制吗? 4)是否有其他更智能的方法来实现我的目标(也许使用cookie或以某种方式在多个窗口/选项卡之间从单个通道分割数据)?

谢谢您和亲切的问候 亚历克斯

I am developing a chat application on top of the Google AppEngine Channel API, and one challenge is in co-ordinating/synchronizing chat when running in multiple windows/tabs (in a single browser).

In particular, if a user has a conversation open in one window/tab, and then opens a new window/tab that connects to my website, I would like for that same conversation to appear in the new window/tab (this is the functionality that Facebook chat and other websites have). I believe that this could be achieved by opening a new channel for each window that the user has open, and letting the server ensure that each channel has the most up-to-date conversation data, but I am concerned about hitting a limit (if there is one) on the number of channels allowed by the Channel API - and am also concerned about the efficiency of this approach.

So, my question is: 1) From an efficiency/effectiveness standpoint, does it makes sense to open a new channel for each window/tab for a single user? 2) Is there any kind of limit on the number of channels that I can open to a single user? 3) is there an overall limit on the number of channels that I can open? 4) is there some other more intelligent way of accomplishing my goals (perhaps using cookies or by somehow splitting data from a single channel between multiple windows/tabs)?

Thank you and kind regards
Alex

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

时光清浅 2024-10-24 02:46:21
  1. 不完全是。

  2. 否。

  3. http:// /code.google.com/intl/ro/appengine/docs/quotas.html
    请阅读“渠道”部分。

  4. 是的,您可以使用 cookie。

  1. Not really.

  2. No.

  3. http://code.google.com/intl/ro/appengine/docs/quotas.html
    Read the Channel section.

  4. Yes, you could use cookies.

奢望 2024-10-24 02:46:21

也许你应该使用sessionStorage,它有用于写入的事件监听,所有具有相同来源的选项卡都会获取事件!

perhaps you should use sessionStorage, it has event listen for writing, all tabs with same origin gets the event!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文