import { Observable } from "rxjs"; import { DurableSocket } from "./durable-socket"; export interface RPCChannel { received: Observable; /** * This optional event signifies that the ongoing state of the channel has been lost, * and any outstanding requests are no longer resolvable. An example of such * an event might be the connection being lost. * * The value of the observable is the error message when state has been lost. */ stateLost?: Observable; /** * This optional event signifies that the channel is ready for communications. * * If provided, then this event must fire as soon as the channel is ready for use * (even if the subscription occurs after the channel becomes ready for use). * * If the channel supports re-establishment, then subscribing to this * observable while re-establishment is occuring must not cause an event until * the channel is re-established. */ ready?: Observable; send(message: string): any; close?(): any; } export declare class LocalChannel implements RPCChannel { private _received; get received(): Observable; send(message: string): void; private otherChannel; static makePair(): [LocalChannel, LocalChannel]; } export declare class SocketChannel implements RPCChannel { readonly socket: WebSocket | RTCDataChannel; constructor(socket: WebSocket | RTCDataChannel); private _ready; get ready(): Observable; markReady(): void; markNotReady(): void; private _stateLost; private _stateLost$; get stateLost(): Observable; private _received; private _received$; get received(): Observable; protected stateWasLost(errorMessage: string): void; send(message: any): Promise; close(): void; } export declare class DurableSocketChannel extends SocketChannel { constructor(socket: DurableSocket); readonly socket: DurableSocket; } export declare class WindowChannel implements RPCChannel { private remoteWindow; constructor(remoteWindow: Window, origin?: string); private handler; private _received; get received(): Observable; send(message: any): void; close(): void; }