How to use the urql.subscriptionExchange function in urql

To help you get started, we’ve selected a few urql 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 smapiot / piral / packages / piral-ext / src / gql / create.ts View on Github external
const errors = err && (Array.isArray(err) ? err : [err]);

      if (errors && errors.length > 0) {
        typeof onDisconnected === 'function' && onDisconnected(errors);
      } else {
        typeof onConnected === 'function' && onConnected();
      }
    },
  });
  const forwardSubscription = operation => subscriptionClient.request(operation);
  return new Client({
    url,
    fetchOptions: config.default || {},
    exchanges: [
      ...defaultExchanges,
      subscriptionExchange({
        forwardSubscription,
      }),
    ],
  });
}

urql

A highly customizable and versatile GraphQL client for React

MIT
Latest version published 8 days ago

Package Health Score

98 / 100
Full package analysis