问题标签 [google-drive-realtime-api]
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.
google-drive-api - 在 30-50 个对象更改后,实时 api 工作非常缓慢
我发现我的带有实时 API 的原型启动工作非常缓慢(协作地图集操作超过 200-500 毫秒,并且这个数字在 10-20 次更改后仍在增长。
您可以使用“编辑演示协作字符串”尝试官方游乐场https://realtimeplayground.appspot.com
在 String textarea 中的每次更改之后,rtpg.string.field.setText(newValue) 开始运行的速度越来越慢,从 10 到 300 毫秒(在 30-40 更改之后)。
实时 API 的性能如何,如何提高?
javascript - 在协作地图中跟踪 ChangeEvent 源
我有一个协作地图,以协作地图为值。当值映射上发生事件时,我想知道该事件属于哪个键(外部映射)。任何人都可以提出一种干净的方法来实现这一目标?
CMap(key, cmapb(k,string)) , ChangeEvent 发生在 cmapb 字符串上,我想知道 CMap 的键。k 仅对单个密钥是唯一的(因此跟踪 k 然后查找包含 k 的密钥不是一种选择)。
编辑:
在将记录(cmapb)添加到 CMAP 之前,我以这种方式附加 EventListener:
如果我可以在 updateJSON 上传递记录的 id,那么我可以遍历 CMAP 以查找具有该 id 的值。虽然我不知道如何传递 id 以及 ChangeEvent。
php - 使用 PHP 使用 Google Drive API 的“列表”方法时收到警告
我们在我们的 Web 应用程序中使用 Google Drive API for PHP,虽然列出、插入和删除工作正常,但在使用该list()
方法时我们不断收到这些警告:
导致出现这两个警告:
我尝试自己修改 API 文件并is_array
在 foreach 之前添加了一个检查,但无济于事。
有任何想法吗?
谢谢!
编辑:客户端 API 从这里下载 http://code.google.com/p/google-api-php-client/
下面的代码会导致警告,所以我添加了is_array
检查,但并没有消除它。
google-drive-realtime-api - Google Realtime API - 在 Google Drive 中创建和删除快捷方式文件
查看Realtime API 快速入门示例,一个快捷方式文件用于存储实时文档模型。我假设这是一个保存实时文档模型状态的文件。
问题:我是否需要为每个协作会话创建和清理此快捷方式文件?
注意:最终我想将数据保存到我的数据库,而不是 Google Drive。
google-drive-api - Google Realtime API - 我的应用程序 ID 是什么?
在这里查看样本
我正在查看 Google API 控制台,我看到了客户端 ID 和 API 密钥,但我找不到带有我的应用程序 ID 的字段。它实际上是标记为应用程序 ID 还是其他?
google-drive-api - Google Realtime API - what is the role of a shortcut file in google drive?
In the quickstart demo, a shortcut file is created in Google Drive. I figure that this shortcut file facilitates the transfer of messages somehow. Can someone explain where this shortcut file points to and it's purpose in Realtime collaboration flow?
google-api - Google Drive Realtime API OAuth2 刷新错误
在过去的几天里,我看到一个长期运行的实时应用程序出现了一些越来越严重的问题。我已经完成了以下步骤,底部的代码片段包含来自应用程序的其他调试信息。
当页面首次打开时,它成功请求 OAuth 令牌并加载实时文档 [A]。50 分钟后(令牌过期前 10 分钟),它成功重新请求新的 OAuth 令牌 [B]。在第一个令牌过期后,当前打开的连接会收到 401 未授权错误并需要新的 oauth 令牌 [C]。这本身似乎是一个问题,因为它应该更新自己以使用来自 [B] 的新的有效令牌。
但是,该应用程序仍应能够应对此类错误发生 - 因此通过关闭并重新打开文档 [D] 并获取另一个新的 OAuth 令牌来处理它。不幸的是,此时实时 API 处于无限循环中,获取 access_token [E] 的错误。
所有 OAuth 令牌都是使用具有相同范围的 gapi.auth.authorize 请求的,并且不调用 setToken。我之前尝试过使用 setToken,但遇到了完全相同的问题。
实际问题 为实时 API 刷新 OAuth 令牌的正确方法是什么?关闭和重新打开文档时,如何防止驱动器 API 内部重复出现故障?
谢谢!
google-drive-api - Google Realtime API - share settings on shortcut file
This is a follow up to Google Realtime API - what is the role of a shortcut file in google drive?
What is the effect of share settings on a shortcut file? Does a user need to share this shortcut file with other collaborators?
In my case, my web application already contains share settings between users. These are my own share setting that I store in my database. They are currently sharing between each other but have to edit a file one person at a time. Ideally I would like to just use the settings from my application to seamlessly make it so that they can collaborate at the same time, without having them to once again give edit permissions.
google-drive-api - 尝试加载实时数据模型时出现 EvalError
我正在尝试在我的 Chrome 打包应用程序中使用gapi.drive.realtime.load方法获取实时数据模型:
但我遇到了一个 EvalError:
未捕获的 EvalError:拒绝将字符串评估为 JavaScript,因为“unsafe-eval”不是以下内容安全策略指令中允许的脚本来源:“script-src 'self' apis.google.com drive.google.com”。
当然,我可以在清单中添加“unsafe-eval”,但我想这是解决这个问题的坏方法。你能提出更好的解决方案吗?