All Projects → leadiq → apollo-link-defer

leadiq / apollo-link-defer

Licence: other
Interface for creating asynchronous links.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to apollo-link-defer

apollo-link-segment
Automatic analytics for Apollo Apps.
Stars: ✭ 18 (+12.5%)
Mutual labels:  apollo, apollo-link
apollo-link-fragment-argument
An Apollo Link to enable to parameterize fragments
Stars: ✭ 35 (+118.75%)
Mutual labels:  apollo, apollo-link
laika
Log, test, intercept and modify Apollo Client's operations
Stars: ✭ 99 (+518.75%)
Mutual labels:  apollo, apollo-link
apollo-link-tracer
Trace your apollo queries and mutations with https://github.com/apollographql/apollo-link
Stars: ✭ 20 (+25%)
Mutual labels:  apollo, apollo-link
vuex-apollo
💚 Vuex-Apollo integration for VueJS
Stars: ✭ 32 (+100%)
Mutual labels:  apollo
downwrite
✍️ Markdown writing application that's down right, neat.
Stars: ✭ 103 (+543.75%)
Mutual labels:  apollo
ios-graphql
iOS code examples with GraphQL, Apollo & more
Stars: ✭ 78 (+387.5%)
Mutual labels:  apollo
react-chat-app
A real-time chat application with Node.js, Prisma, GraphQL, Next.js, React.js and Apollo.
Stars: ✭ 61 (+281.25%)
Mutual labels:  apollo
skycloud-base
🔥springcloud脚手架,配置中心(apollo/nacos) 注册中心(consul/nacos) 分布式事物(seata) 调用链(skywalking) 日志(ELK)监控(prometheus与grafana) 等,适合学习与快速开发使用
Stars: ✭ 80 (+400%)
Mutual labels:  apollo
graphql-ts-client
Typescript DSL for GraphQL.
Stars: ✭ 124 (+675%)
Mutual labels:  apollo
guchub
🎓 Elegantly manage your GUC academic life
Stars: ✭ 15 (-6.25%)
Mutual labels:  apollo
corporate-dashboard
🔥 A blazingly fast corporate dashboard single page web application, built with a focus on component oriented design with React, Relay & GraphQL
Stars: ✭ 52 (+225%)
Mutual labels:  apollo
bs-reason-apollo
ReactApollo bindings for BS
Stars: ✭ 23 (+43.75%)
Mutual labels:  apollo
boilerplate
Boilerplate for @prisma-cms
Stars: ✭ 22 (+37.5%)
Mutual labels:  apollo
Todo-apollo-redux-react-native
Todo App with apollo + redux + react-native
Stars: ✭ 15 (-6.25%)
Mutual labels:  apollo
spring-boot-learn-box
spring boot集成其他组件
Stars: ✭ 21 (+31.25%)
Mutual labels:  apollo
wongames
🎮 Ecommerce de jogos no estilo Steam. Desenvolvido com Next.js, TypeScript, GraphQL, etc.
Stars: ✭ 18 (+12.5%)
Mutual labels:  apollo
graphql-client-example-server
A simple GraphQL server for powering examples of various GraphQL clients in various languages.
Stars: ✭ 34 (+112.5%)
Mutual labels:  apollo
nuxtjs-woocommerce
NuxtJS (Vue) eCommerce site with WooCommerce backend
Stars: ✭ 83 (+418.75%)
Mutual labels:  apollo
nap
[Deprecated] NextJS + Apollo + PassportJS
Stars: ✭ 52 (+225%)
Mutual labels:  apollo

Defer Link

Purpose

An Apollo Link to allow links to asynchronously be prepared, even after the ApolloClient has been constructed.

Installation

npm install apollo-link-defer --save

Usage

import { WebSocketLink } from 'apollo-link-ws'
import { SubscriptionClient } from 'subscriptions-transport-ws'
import { deferLink } from "apollo-link-defer";

const deferredSubscriptionLink =
  Promise.resolve('/api/v1/eventbus')
    .then(path => api.get(path))
    .then(({ uri, address }) => {
      const token = cookie.get()
      return new SubscriptionClient(
        `${uri}/bridge?token=${token}&play_uri=${API_SERVER}`,
        { reconnect: true, connectionParams: { type: 'register', address } },
        SockJS
      )
    })
    .then(client => new WebSocketLink(client))

// This prevents the underlying link from being created until we have the correct URL.
const wsLink = deferLink(resolveSubscriptionLink)

// The client can still be built while we wait for the link to finish setting up.
// It will transparently be used once the link is successfully instantiated.
const client = new ApolloClient({link: wsLink})
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].