Module

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

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

@polkadot/rpc-provider/ws

Examples

import Api from 'https://deno.land/x/polkadot@0.2.38/api/promise/index.ts';
import { WsProvider } from 'https://deno.land/x/polkadot@0.2.38/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>