api-platform 在更新标记为的资源时自动向 Mercure 中心发出事件,mercure=true
并发布主题以在相应的GET
端点中侦听。好的。是否已经有一个选项可以在生成的 GraphQL 端点中使用?
美居文档说:https://github.com/dunglas/mercure#how-to-use-mercure-with-graphql美居应该“很好地”与任何 GraphQL API 集成,只要它“返回相应的主题 URL ”。但是 afaik 由 api-platform 生成的 GraphQL API 没有(https://api-platform.com/docs/core/mercure/)。我错过了什么还是即将到来?在前端使用 apollo-vue。
为了解决这个问题,我可以使用EventSource
前端的专用主题来收听所有实体 ID 的变化。我会使用http://localhost:8080/product_streams/{id}
那里的 URI 模板。但我无法编写一个仅匹配某些 id 的 uri 模板,例如:仅http://localhost:8080/product_streams/{id:123,456,789}
获取流 123 456 789 的更新(尝试https://uri-template-tester.mercure.rocks/ && https://www .rfc-editor.org/rfc/rfc6570#page-18)没有成功:(