Skip to main content
Module

x/polkadot/mod.ts>api.WsProvider

Package publishing for deno.land/x/polkadot
Go to Latest
class api.WsProvider
implements ProviderInterface
import { api } from "https://deno.land/x/polkadot@0.2.40/mod.ts";
const { WsProvider } = api;

@polkadot/rpc-provider/ws

Examples

import Api from 'https://deno.land/x/polkadot@0.2.40/api/promise/index.ts';
import { WsProvider } from 'https://deno.land/x/polkadot@0.2.40/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
endpoint: string
readonly
endpointStats: EndpointStats
readonly
hasSubscriptions: boolean
readonly
isClonable: boolean
readonly
isConnected: boolean
readonly
isReady: Promise<WsProvider>
readonly
stats: ProviderStats

Methods

protected
selectEndpointIndex(endpoints: string[]): number
connect(): Promise<void>
connectWithRetry(): Promise<void>
disconnect(): Promise<void>
on(type: ProviderInterfaceEmitted, sub: ProviderInterfaceEmitCb): () => void
send<T = any>(
method: string,
params: unknown[],
isCacheable?: boolean,
subscription?: SubscriptionHandler,
): Promise<T>
subscribe(
type: string,
method: string,
params: unknown[],
callback: ProviderInterfaceCallback,
): Promise<number | string>
unsubscribe(
type: string,
method: string,
id: number | string,
): Promise<boolean>