- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 firebase-admin for nodejs(版本 7.3.0)发送推送通知。对于使用方法 sendAll 发送的 40k 不同消息,服务器经常收到此错误:
“通过“凭据”提供给 initializeApp() 的凭据实现属性无法获取有效的 Google OAuth2 访问 token 以下错误:“获取访问 token 时出错:发出请求时出错:套接字挂断。错误代码:ECONNRESET”。
有时效果很好,但并非始终如此。
var admin = require('firebase-admin');
serviceAccount = require('/path_json_adminsdk/yyyyyyyyyy.json');
var defaultApp = admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: 'https://api-project-yyyyyy'
});
var k = 42000;
var contorMessages = 0;
var messages = [];
for(var i=0;i <em><</em> k; i++){
//.......
contorMessages = contorMessages + 1;
var tmp = {
alert: body.alert,
payload: body.payload
};
//form the array to be sent
messages.push({
data: {"body": JSON.stringify(tmp)},
token: body.token
});
if(contorMessages == 100){
SEDispatcher.emit('sendMessageFirebaseMulticast',messages);
contorMessages = 0;
messages = [];
}
}
SEDispatcher.on('sendMessageFirebaseMulticast', function(messages){
var dryRun = true;
admin.messaging().sendAll(messages, dryRun)
.then(function(response) {
//console.log("response:",response);
//responses = response.responses;
//.......
})
.catch((error) => {
console.log(' +++ Error sending message:', error);
});
});
有时会出现的错误:
+++ Error sending message: { Error: Credential implementation provided to initializeApp() via the "credential" property failed to fetch a valid Google OAuth2 access token with the following error: "Error fetching access token: Error while making request: socket hang up. Error code: ECONNRESET". at FirebaseAppError.Error (native) at FirebaseAppError.FirebaseError [as constructor] (/opt/node/test/node_modules/firebase-admin/lib/utils/error.js:42:28) at FirebaseAppError.PrefixedFirebaseError [as constructor] (/opt/node/test/node_modules/firebase-admin/lib/utils/error.js:88:28) at new FirebaseAppError (/opt/node/test/node_modules/firebase-admin/lib/utils/error.js:122:28) at /opt/node/test/node_modules/firebase-admin/lib/firebase-app.js:121:23 at process._tickCallback (internal/process/next_tick.js:103:7) errorInfo: { code: 'app/invalid-credential', message: 'Credential implementation provided to initializeApp() via the "credential" property failed to fetch a valid Google OAuth2 access token with the following error: "Error fetching access token: Error while making request: socket hang up. Error code: ECONNRESET".' }, codePrefix: 'app' }
最佳答案
const messaging = getMessaging(defaultApp);
需要加载
关于node.js - 使用 firebase-admin 的 nodejs 中的错误方法 sendAll(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56054642/
我写了我认为相当简单的脚本,可以使用Python套接字通过网络下载文件,但是服务器卡在服务器端的socket.sendall上。我可以获得一次我想要的文件,但是随后对senddata的调用导致崩溃。
我有这个代码。它不是完整的代码,因为它是一个 Blender 插件,有许多与套接字无关的行,所以我在这里只给出处理套接字的部分,我将其与程序的其余部分隔离。 如果您想查看完整代码,可以在这里找到 ht
我正在努力使用客户端/服务器设置的 .sendall() 方法。多个客户端可以单独连接并向服务器发送消息并获得回显响应。但是,我希望发送的消息在类似聊天的环境中显示给所有连接的客户端。 这是在服务器应
我正在阅读 Tutorial on Network Programming with Python ,在这篇文档中,作者说“函数 sendall() 应该只用于阻塞套接字。” 但我在 Python 文
我有一个多线程程序(大约 20 个线程;生产者/消费者与许多队列的混合) 在其中一个线程中,它从队列中弹出字符串并将其发送到远程程序 # it starts the thread like this
我当前的 python 脚本: import os import ftplib import hashlib import glob hashing = "123" m = hashlib.md5()
这篇文章被错误地标记为“发送”,因为我无法创建新标签。 关于这个简单的回显服务器,我有一个非常基本的问题。以下是一些代码片段。 客户 while True: data = raw_input("En
前几天我在查看一些 Python 代码时发现了这个: s.sendall(req % (len(body), body)) 其中 len(body) 解析为超过 500K 字节。该数据被发送到
我有一个简单的脚本,可以将图像文件从一台机器传输到另一台机器,进行图像处理并将结果返回为“骰子计数”。问题是随机收到的图像是部分灰色的。似乎没有关于传输何时未完成的原因,我在代码中看不到其他问题。客户
在我的代码中我写了这样的东西: try: s.sendall(data) except Exception as e: print e 现在,我可以假设如果 sendall 没有抛出任
我正在尝试用 python 开发一个聊天程序。我希望它有多个客户端,所以我使用线程来处理这个问题。但是,当我尝试将消息发送到所有连接的客户端时,服务器仅将其发送到发送消息的客户端。我不确定我是否遗漏了
我正在尝试使用 python 套接字来尝试更好地理解整个概念,但我遇到了问题。我有一个简单的服务器和一个客户端,客户端向服务器发送一个列表,然后等待服务器发送一个字符串,表示该过程已完成。 这是客户端
关于我的问题,我是一名计算机专业的学生,第一次开始使用 Python。在此之前,我主要从事 Java 工作,现在我最熟悉 Java 约定和实践。 背景 套接字编程的作业要求我们在机器本地的服务器和
我有一些代码使用简单的 tcp 套接字设置来测试某些东西。我们在 python 文件上运行 pylint --errors-only,通常作为验证我们所有代码的一种方式。 但是,python 套接字库
我对 Python 中的 socket.send() 和 socket.sendall() 函数感到困惑。据我了解the documentation send() 函数使用 TCP 协议(protoc
当使用 recv() 方法时,有时我们无法收到我们想要的数据,就像使用 send() 一样。但是我们可以使用sendall()来解决发送数据的问题,那么接收数据呢?为什么没有这样的 recvall()
我使用 firebase-admin for nodejs(版本 7.3.0)发送推送通知。对于使用方法 sendAll 发送的 40k 不同消息,服务器经常收到此错误: “通过“凭据”提供给 ini
我正在将 char * 从 OF 发送到一个小板。 这是我的代码: void ofApp::draw() { string message = ""; int total = 1472
我目前正在尝试在用 C 编写的服务器中实现一个 sendall() 函数,并在用 python 编写的相应客户端上实现一个 recvall() 函数。 当服务器和客户端都用相同的语言编写时(即都用 c
我提供了一个工作客户端和服务器文件。客户端向服务器发送图片。当你注释掉时: data = sock.recv(1024) print("received: ",str(data,"UTF-8")) 图
我是一名优秀的程序员,十分优秀!