Dol*_*rma 5 laravel graphql laravel-lighthouse laravel-websockets
实现一个简单的GraphQl
查询(例如 simple)Mutation
后Subscription
,当我尝试将其运行subscription
到graphql-playground
:
subscription {
userCreated{
name
username
password
}
}
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
{
"error": "Could not connect to websocket endpoint ws://127.0.0.1:8000/graphql.
Please check if the endpoint url is correct."
}
Run Code Online (Sandbox Code Playgroud)
GraphQl 架构:
#...
type User {
id: Int!
name: String
email: String
product : [Product!]
}
type Mutation {
createUser(
name: String!
password: String!
email : String!
): User @field(resolver:"UserMutator@create") @broadcast(subscription: "userCreated")
}
type Subscription {
userCreated: User
}
Run Code Online (Sandbox Code Playgroud)
UserMutator
班级:
subscription {
userCreated{
name
username
password
}
}
Run Code Online (Sandbox Code Playgroud)
UserCreated
订阅
{
"error": "Could not connect to websocket endpoint ws://127.0.0.1:8000/graphql.
Please check if the endpoint url is correct."
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
353 次 |
最近记录: |