How to use the react-relay-network-modern/es.RelayNetworkLayer function in react-relay-network-modern

To help you get started, we’ve selected a few react-relay-network-modern examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github coralproject / talk / src / core / client / framework / lib / network / createNetwork.ts View on Github external
export default function createNetwork(
  subscriptionClient: ManagedSubscriptionClient,
  tokenGetter: TokenGetter,
  clientID: string
) {
  return new RelayNetworkLayer(
    [
      customErrorMiddleware,
      cacheMiddleware({
        size: 100, // max 100 requests
        ttl: 900000, // 15 minutes
        clearOnMutation: true,
      }),
      urlMiddleware({
        url: () => Promise.resolve(graphqlURL),
      }),
      retryMiddleware({
        fetchTimeout: 15000,
        retryDelays: (attempt: number) => Math.pow(2, attempt + 4) * 100,
        // or simple array [3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600],
        statusCodes: [500, 503, 504],
        beforeRetry: ({ abort, attempt }) => {
github berty / berty / client / react-native / common / relay / environment.js View on Github external
export const setup = async ({ getIp, getPort }) => {
  return new Environment({
    network: new RelayNetworkLayer(await setupMiddlewares({ getIp, getPort }), {
      subscribeFn: setupSubscription({
        ip: await getIp(),
        port: await getPort(),
      }),
    }),
    store: new Store(new RecordSource()),
  })
}
github berty / berty / client / react-native / app / relay / environment.js View on Github external
export const setup = async ({ getIp, getPort }) => {
  return new Environment({
    network: new RelayNetworkLayer(await setupMiddlewares({ getIp, getPort }), {
      subscribeFn: setupSubscription({
        ip: await getIp(),
        port: await getPort(),
      }),
    }),
    store: new Store(new RecordSource()),
  })
}