TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

GraphQL Live Queries with live directive

22 pointsby tobaseover 2 years ago

3 comments

satvikpendemover 2 years ago
I love GraphQL, it makes generating types for any language very easy, with one schema, and you don&#x27;t have to worry about the shape of the response on either the server or the client due to such types. If you don&#x27;t need multiple clients and are using TypeScript, you could use trpc though (and with Rust I also know of rspc).<p>This article is interesting, however it seems `@live` isn&#x27;t part of the official specification. Also, you can use something like TanStack Query to synchronize server state, which works with GraphQL as well as regular REST, or you can use a GraphQL client directly like Apollo or urql, which also does the same syncing, so I&#x27;m not sure for what purpose this directive serves exactly. Maybe it&#x27;s for languages that don&#x27;t have a good server side syncing library?
评论 #34405075 未加载
评论 #34405169 未加载
评论 #34405072 未加载
Emigre_over 2 years ago
The &#x27;live queries&#x27; RFC in the GraphQL spec has been in strawman stage (RFC 0) for a while.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;graphql&#x2F;graphql-spec&#x2F;issues&#x2F;386">https:&#x2F;&#x2F;github.com&#x2F;graphql&#x2F;graphql-spec&#x2F;issues&#x2F;386</a>
评论 #34410269 未加载
vlaaadover 2 years ago
Huh, I&#x27;ve been thinking about a very similar service that does not require a dependency on GraphQL — <a href="https:&#x2F;&#x2F;poll2hook.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;poll2hook.com&#x2F;</a><p>You can define a query on any API, be it GraphQL or REST, and a jq query to extract events, and you are good to go. I wonder if this @live directive is implemented with polling?
评论 #34405188 未加载
评论 #34410288 未加载