@storybook/channel-websocket
Version:
Storybook Websocket Channel is a channel for Storybook that can be used when the Storybook Renderer should communicate with the Storybook Manager over the network. A channel can be created using the `createChannel` function.
29 lines (26 loc) • 771 B
TypeScript
import { ChannelHandler, Channel } from '@storybook/channels';
type OnError = (message: Event) => void;
interface WebsocketTransportArgs {
url: string;
onError: OnError;
}
interface CreateChannelArgs {
url?: string;
async?: boolean;
onError?: OnError;
}
declare class WebsocketTransport {
private socket;
private handler;
private buffer;
private isReady;
constructor({ url, onError }: WebsocketTransportArgs);
setHandler(handler: ChannelHandler): void;
send(event: any): void;
private sendLater;
private sendNow;
private flush;
private connect;
}
declare function createChannel({ url, async, onError, }: CreateChannelArgs): Channel;
export { WebsocketTransport, createChannel, createChannel as default };