src/web-socket-handler

WebSocketHandler

class WebSocketHandler implements WebSocketInterface 

handleStandardStreams

public static handleStandardStreams(
        streamNum: number,        buff: Buffer,        stdout: stream.Writable | null,        stderr: stream.Writable | null,    ): V1Status | null 

handleStandardInput

public static handleStandardInput(
        ws: WebSocket.WebSocket,        stdin: stream.Readable,        streamNum: number = 0,    ): boolean 

processData

public static async processData(
        data: string | Buffer,        ws: WebSocket.WebSocket | null,        createWS: () => Promise<WebSocket.WebSocket>,        streamNum: number = 0,        retryCount: number = 3,        encoding?: BufferEncoding | null,    ): Promise<WebSocket.WebSocket | null> 

restartableHandleStandardInput

public static restartableHandleStandardInput(
        createWS: () => Promise<WebSocket.WebSocket>,        stdin: stream.Readable,        streamNum: number = 0,        retryCount: number = 3,        // kind of hacky, but otherwise we can't wait for the writes to flush before testing.        addFlushForTesting: boolean = false,    ): () => WebSocket.WebSocket | null 

constructor

public constructor(
        kc: KubeConfig,        socketFactoryFn?: (            uri: string,            protocols: string[],            opts: WebSocket.ClientOptions,        ) => WebSocket.WebSocket,        streamsInterface: StreamInterface = {            stdin: process.stdin,            stdout: process.stdout,            stderr: process.stderr,        },    ) 

connect

Connect to a web socket endpoint.

Parameters

path The HTTP Path to connect to on the server.

textHandler Callback for text over the web socket.

Returns true if the connection should be kept alive, false to disconnect.

binaryHandler Callback for binary data over the web socket.

Returns true if the connection should be kept alive, false to disconnect.
public async connect(
        path: string,        textHandler: ((text: string) => boolean) | null,        binaryHandler: ((stream: number, buff: Buffer) => boolean) | null,    ): Promise<WebSocket.WebSocket> 
Start typing to search the documentation Press ESC to close