Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/polkadot/rpc-provider/ws/index.ts>WsProvider

Package publishing for deno.land/x/polkadot
Go to Latest
class WsProvider
implements ProviderInterface
import { WsProvider } from "https://deno.land/x/polkadot@0.2.14/rpc-provider/ws/index.ts";

@polkadot/rpc-provider/ws

Examples

import Api from 'https://deno.land/x/polkadot@0.2.14/api/promise/index.ts';
import { WsProvider } from 'https://deno.land/x/polkadot@0.2.14/rpc-provider/ws/index.ts';

const provider = new WsProvider('ws://127.0.0.1:9944');
const api = new Api(provider);

Constructors

new
WsProvider(
endpoint?: string | string[],
autoConnectMs?: number | false,
headers?: Record<string, string>,
timeout?: number,
)

Properties

readonly
hasSubscriptions: boolean
readonly
isClonable: boolean
readonly
isConnected: boolean
readonly
isReady: Promise<WsProvider>
readonly
stats: ProviderStats

Methods

connect(): Promise<void>
connectWithRetry(): Promise<void>
disconnect(): Promise<void>
send<T = any>(
method: string,
params: unknown[],
isCacheable?: boolean,
subscription?: SubscriptionHandler,
): Promise<T>
subscribe(
type: string,
method: string,
params: unknown[],
): Promise<number | string>
unsubscribe(
type: string,
method: string,
id: number | string,
): Promise<boolean>