我的架构:
subscription do
@desc "Subscribe to drawing change"
field :drawing_change, :drawing do
# arg(:drawing_id, non_null(:id))
config(fn _args, _resolution ->
{:ok, topic: "*"}
end)
end
end
当我做
subscription {
drawingChange {
data
name
}
}
我收到这个错误TypeError: Failed to fetch
日志:
[debug] Processing with Absinthe.Plug
Parameters: %{"query" => "subscription {\n drawingChange {\n data\n name\n }\n}", "variables" => nil}
Pipelines: [:api]
[debug] ABSINTHE schema=DrawingApiWeb.Schema.Schema variables=%{}
---
subscription {
drawingChange {
data
name
}
}
---
[info] Chunked 200 in 107ms
这是我的其余设置:
用户套接字:
use Absinthe.Phoenix.Socket, schema: DrawingApiWeb.Schema.Schema
端点:
use Absinthe.Phoenix.Endpoint
路由器:
forward "/graphiql", Absinthe.Plug.GraphiQL,
schema: DrawingApiWeb.Schema.Schema,
socket: DrawingApiWeb.UserSocket
所有这一切都发生在我对任何上下文进行任何更改之前。无论问题是什么,它都应该在设置中。我已按照 Absinthe-GraphQL 书和 Pragmatic Studio 视频中的确切说明进行操作,并使用https://hexdocs.pm/absinthe/subscriptions.html进行了验证
还是同样的错误。提前谢谢你的帮助。