npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-nitro-networking

v0.0.1-alpha.17

Published

The runtime calls `installNetworkingGlobals()` from `react-nitro-networking/installNetworkingGlobals` at startup to install `fetch`, `Headers`, `AbortController`, `AbortSignal`, and `ReadableStream`. Importing `react-nitro-networking` on its own leaves gl

Readme

React Nitro Networking

The runtime calls installNetworkingGlobals() from react-nitro-networking/installNetworkingGlobals at startup to install fetch, Headers, AbortController, AbortSignal, and ReadableStream. Importing react-nitro-networking on its own leaves globals untouched.

Fetch

Call Networking.fetch() directly on the imported class:

import { Networking, Response } from 'react-nitro-networking'

const response = await Networking.fetch('https://example.com')
console.log(response instanceof Response) // true
console.log(await response.text())

Pass request headers as an optional string record:

const response = await Networking.fetch('https://example.com/api/items', {
  headers: { Accept: 'application/json' },
})

To post JSON, pass the serialized text and set its content type.

import { Networking, RequestMethod } from 'react-nitro-networking'

const body = JSON.stringify({ text: 'Hello' })
const response = await Networking.fetch('https://example.com/api/items', {
  method: RequestMethod.POST,
  headers: { 'Content-Type': 'application/json' },
  body: body,
})

The supported methods are GET (default), HEAD, POST, PUT, PATCH, DELETE, and OPTIONS. Both RequestMethod.POST and the uppercase literal 'POST' are type-checked. Enum members pass directly to the native bridge as numbers. A body on GET or HEAD rejects the promise. Strings use UTF-8 and default to text/plain;charset=UTF-8. An ArrayBuffer, typed array, or DataView sends its byte range and defaults to application/octet-stream.

Apps can also pass URLSearchParams, Blob, or FormData from their web API polyfills. Search parameters use URL-encoded form data. A blob uses its MIME type. For multipart uploads, Swift and Kotlin assemble the body and set its content type. React Native form parts can reference files by URI. The native transport reads those files directly.

The runtime's global fetch accepts the same body types, a URL object, and request headers supplied as Headers, a headers polyfill with get and forEach, a record, or pairs. Use response.headers.get(name) for a case-insensitive lookup and response.headers.getSetCookie() for individual cookies. For direct Networking.fetch calls, response.headers is a string record and response.headerEntries exposes the individual entries.

On Apple platforms, URLSession combines repeated Set-Cookie fields. The runtime preserves commas in expiration dates and quoted values. An unquoted , name=value inside a cookie attribute is indistinguishable from a new cookie.

Redirects are followed across origins. A caller-supplied Authorization header stays on the original origin and is removed once the request leaves it. A 303 after a POST sends a GET without the body. A 307 or 308 preserves the method and body.

Pass an AbortSignal to global fetch to cancel the native request. Several requests can share one signal. Aborting after headers arrive also cancels a pending body read.

const controller = new AbortController()
const response = fetch('https://example.com', { signal: controller.signal })
controller.abort()

WebSockets

new WebSocket(url) starts connecting immediately. Each socket supports text and ArrayBuffer messages. Listeners are additive and return a subscription with an idempotent remove().

import { WebSocket } from 'react-nitro-networking'

const socket = new WebSocket('wss://example.com/socket')
const messages = socket.addOnMessageReceivedListener((data) => {
  console.log(data)
})
socket.addOnOpenedListener(() => console.log('Connected'))
socket.addOnErrorListener((error) => console.error(error))
socket.addOnClosedListener(() => console.log('Closed'))

try {
  // send() waits for the handshake if the connection is still opening.
  await socket.send('Hello')
} catch (error) {
  console.error('Could not send:', error)
}

// When the connection is no longer needed:
messages.remove()
socket.close()

Binary messages use the same methods. Await sends to preserve their order:

await socket.send(new Uint8Array([0, 1, 255]).buffer)
await socket.send(new ArrayBuffer(0))

Invalid URLs throw from the constructor. Handshake and transport failures notify error listeners, then closed listeners. Late opened listeners are notified if the socket is still open; late error and closed listeners receive the terminal outcome. close() is idempotent, releases listeners, and reports local shutdown without waiting for a peer acknowledgement. Reconnecting requires a new socket.

Receiving starts immediately. Until the first message listener is registered, up to 64 messages or 1 MiB are buffered. Exceeding either limit closes the connection with an error. After the first subscription, messages without listeners are discarded. Closing also discards buffered messages.

Apple platforms use URLSessionWebSocketTask; Android uses Nitro Fetch's native libwebsockets/mbedTLS transport, with no Java payload bridge. On Android, send() resolves when the native send queue accepts the message. Use an application acknowledgement when delivery needs to be confirmed. The Android host closes its network operations when the runtime ends.

Android HTTP

HTTP uses the embedded Cronet engine from react-native-nitro-fetch, with HTTP/2, QUIC, Brotli, and a shared 50 MiB disk cache. It does not require Google Play Services. The runtime prewarms the engine with the application context.

Fetch resolves when response headers arrive. Body methods start reading on demand, with Cronet writing into direct buffers. Repeated body reads remain supported; arrayBuffer() returns an independent copy each time.

Native transport sources, pinned revisions, and license attribution are documented in third-party/nitro-fetch.