New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

@dedot/providers

Package Overview
Dependencies
Maintainers
1
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dedot/providers

JSON-RPC Providers

latest
Source
npmnpm
Version
1.4.0
Version published
Weekly downloads
868
4.96%
Maintainers
1
Weekly downloads
 
Created
Source

@dedot/providers

JSON-RPC Providers

Custom request headers (WsProvider)

Custom HTTP headers can be sent along with the websocket opening handshake, e.g: to authenticate with a private RPC endpoint or proxy.

import { WsProvider } from '@dedot/providers';

const provider = new WsProvider({
  endpoint: 'wss://private.rpc',
  headers: {
    Authorization: `Bearer ${process.env.API_TOKEN}`,
    'X-Client-ID': 'example-client',
  },
});

Headers can also be resolved on each connection attempt (including reconnects), which is helpful to refresh short-lived tokens or to use different credentials per endpoint:

const provider = new WsProvider({
  endpoint: ['wss://private.rpc', 'wss://private-backup.rpc'],
  headers: async ({ attempt, currentEndpoint }) => ({
    Authorization: `Bearer ${await fetchToken(currentEndpoint)}`,
  }),
});

[!NOTE] Custom headers are only supported in non-browser environments (Node.js, Bun). Browsers do not allow setting headers for the websocket opening handshake, the headers are ignored and a warning is logged in that case.

FAQs

Package last updated on 06 Sep 2026

Related posts