1 Answer
- Newest
- Most votes
- Most comments
0
【以下的回答经过翻译处理】 我找到了答案,将 forEach 循环改为 for 循环。
原代码如下:
items?.forEach(async (item) => {
await apigwManagementApi.postToConnection(params).promise()
});
改为:
for (const item of items) {
await apigwManagementApi.postToConnection(params).promise()
}
我无法解释原理,但它确实有效,消息即时发送到 WebSocket。
Relevant content
- Accepted Answerasked 6 months ago
- Accepted Answerasked 2 months ago
- asked a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago