下面是关于Django的GraphQL订阅的教程。 但在路由通道上没有“route_class”成员。 但我不知道为什么。 有人知道如何使用通道路由吗
class Suscription(ObjectType):
count_seconds = Int(up_to=Int())
def resolve_count_seconds(root, info, up_to=5):
return Observable.interval(1000).map(lambda i: "{0}".format(i))\
.take_while(lambda i: int(i) <= up_to)
ROOT_SCHEMA = graphene.Schema(query=Query, mutation=Mutation, suscription=Suscription)
#urls
from channels.routing import route_class # route_class does not exists
from graphql_ws.django_channels import GraphQLSubscriptionConsumer
channel_routes = [
route_class(GraphQLSubscriptionConsumer, path='subscriptions')
]
目前没有回答
相关问题 更多 >
编程相关推荐