Skip to main content

Supported browsers & frameworks

Connect supports all modern web browsers that implement the widely available fetch API and the Encoding API. The library and the generated code are compatible with ES2017 and TypeScript 4.1.

Connect is entirely framework-agnostic and will even work with vanilla Javascript. It is compatible with commonly-used package managers such as npm, pnpm, and Yarn. It works out of the box with most popular application and testing frameworks including React, Remix, Svelte, Vue, Playwright and Vitest. It also integrates seamlessly with various module loaders and bundlers such as esbuild, Vite and Rollup.

You can find examples for many popular frameworks in the examples-es repo.

React Native

React Native does not offer great support for the Fetch API and the Text Encoding API. As such, React Native requires a polyfill for these two implementations. We recommend the following to accomplish this:

  1. Install the polyfills.
npm install react-native-fast-encoder react-native-fetch-api web-streams-polyfill
  1. Apply the polyfills in the root of your app.
import { polyfillGlobal } from "react-native/Libraries/Utilities/PolyfillFunctions"
import TextEncoder from "react-native-fast-encoder"
import { fetch, Headers, Request, Response } from "react-native-fetch-api"
import { ReadableStream } from "web-streams-polyfill"

polyfillGlobal("ReadableStream", () => ReadableStream)
polyfillGlobal("TextDecoder", () => TextEncoder)
polyfillGlobal("TextEncoder", () => TextEncoder)
polyfillGlobal(
"fetch", () => (...args) => fetch(args[0], {
...args[1],
// Inject textStreaming: https://github.com/react-native-community/fetch/issues/15
reactNative: { textStreaming: true }
}),
)
polyfillGlobal("Headers", () => Headers)
polyfillGlobal("Request", () => Request)
polyfillGlobal("Response", () => Response)

Unfortunately, only unary requests via the Connect protocol are supported in React Native due to some limitations in React Native's implementation of the Fetch API. For more information, please see this issue

For a working example, see the React Native project in the examples-es repo.