Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@embrace-io/react-native-apollo-graphql

Package Overview
Dependencies
Maintainers
4
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@embrace-io/react-native-apollo-graphql

This is used to track networks calls using GraphQL with the Embrace SDK

latest
Source
npmnpm
Version
5.2.0
Version published
Weekly downloads
80
370.59%
Maintainers
4
Weekly downloads
 
Created
Source

React Native Embrace - Apollo GraphQL

[!IMPORTANT]

This module requires React Native Embrace SDK.

Embrace can collect basic session data and crashes as you've already seen in the Crash Reporting and Session Reporting sections. Embrace can also collect the network requests your app makes when using Apollo GraphQL. Here's how you add the Apollo GraphQL tracker to the session.

Install the component

yarn add @embrace-io/react-native-apollo-graphql

Or

npm install @embrace-io/react-native-apollo-graphql

Adding the component to your code

Apply the Apollo GraphQL tracker to your Apollo provider instance.

import EmbraceApolloLink from "@embrace-io/react-native-apollo-graphql";
import {
  ApolloClient,
  InMemoryCache,
  ApolloProvider,
  ApolloLink,
  createHttpLink,
  useMutation,
  gql,
  useQuery,
} from "@apollo/client";

const App = () => {
  return <MyApp />;
};
const ApolloWrapper = () => {
  // Start - Add this line
  const embraceCreateHttpLink = new EmbraceApolloLink.build(
    ApolloLink,
    createHttpLink
  );
  // End - Add this line
  const client = new ApolloClient({
    // Use the Embrace create Http Link
    link: embraceCreateHttpLink({
      uri: "https://api.mocki.io/v2/c4d7a195/graphql",
      headers: { "x-emb-path": "/graphql/v1beta/steve" },
    }),

    cache: new InMemoryCache(),
  });
  return (
    <ApolloProvider client={client}>
      <App />
    </ApolloProvider>
  );
};

[!TIP]

The build method has a third parameter that is platform, you can pass ios or android, if you only want to track in one of them

Keywords

embrace

FAQs

Package last updated on 06 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts