问题描述
限时送ChatGPT账号..我正在我的 React 应用上调用这个 graphql 订阅:
I am calling this graphql subscription on my react app:
export const OnCreateMessage = `
subscription OnCreateMessage($conversationId: ID!) {
onCreateMessage(messageConversationId: $conversationId) {
id
content
authorId
messageConversationId
createdAt
}
}
`
这就是我在类组件中调用它的方式:
This is how I call it inside a class component:
API.graphql(
graphqlOperation(subscriptions.OnCreateMessage, {conversationId: "c074c7b7-f6db-459a-a1d8-cd290aee33ea"})
).subscribe({
next: ({ provider, value }) => console.log({provider, value}),
error: error => console.warn("did not get messages")
});
但是,当我运行我的应用程序并调用它时,我的网络选项卡上出现此错误:
However, when I run my app and this is called, I get this error on my network tab:
{
"errors" : [ {
"errorType" : "BadRequestException",
"message" : "Subscriptions over MQTT is not supported."
} ]
}
我在 AWS 文档中看到MQTT over WebSockets 将不再可用于新的 AppSync API".但我现在不知道该怎么办.
I saw on the AWS docs that "MQTT over WebSockets will no longer be available for new AppSync APIs" but I don't know what to do now.
有人可以调查一下并帮助我吗?
Can someone look into this and help me out?
推荐答案
我不确定你是否找到了答案,但我们在一个项目中面临同样的问题,它要求你使用 GraphQL 客户端可以通过纯 WebSockets 处理订阅.请参阅关于使用 AWS AppSync 客户端的这个问题的答案.
I'm not sure if you found an answer to this, but we are facing the same thing with a project and it requires that you use a GraphQL client that can handle subscriptions over pure WebSockets. See the answer to this question about using the AWS AppSync client.
这篇关于由于 MQTT 错误,AWS App Sync 订阅不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论