DefinitelyTyped/types/rsocket-websocket-client/RSocketWebSocketClient.d.ts
brycematheson1234 70b782ba42 . (#37761)
2019-08-20 14:49:17 -07:00

34 lines
1.0 KiB
TypeScript

import { ConnectionStatus, DuplexConnection, Frame, ISubject, ISubscriber, ISubscription, CONNECTION_STATUS } from 'rsocket-types';
import { Flowable } from 'rsocket-flowable';
import {
deserializeFrame,
deserializeFrameWithLength,
Encoders,
printFrame,
serializeFrame,
serializeFrameWithLength,
toBuffer,
} from 'rsocket-core';
import * as ws from 'ws';
export interface ClientOptions {
url: string;
wsCreator?: (url: string) => WebSocket;
debug?: boolean;
lengthPrefixedFrames?: boolean;
}
/**
* A WebSocket transport client for use in browser environments.
*/
export default class RSocketWebSocketClient implements DuplexConnection {
constructor(options: ClientOptions, encoders?: Encoders<any>);
close(): void;
connect(): void;
connectionStatus(): Flowable<ConnectionStatus>;
receive(): Flowable<Frame>;
sendOne(frame: Frame): void;
send(frames: Flowable<Frame>): void;
}