JS API Reference

Class: TcpProxy

network/tcpProxy.TcpProxy

Allows proxying of TCP traffic to a service running in an activity on a provider via the requestor

IMPORTANT

This feature is supported only in the Node.js environment. In has no effect in browsers.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new TcpProxy(wsUrl, appKey, options): TcpProxy

Parameters

NameTypeDescription
wsUrlstringThe URL to the WebSocket implementing the communication transport layer
appKeystringThe yagna app-key used to authenticate the WebSocket connection
optionsPartial<TcpProxyOptions>Additional options of the proxy

Returns

TcpProxy

Defined in

src/network/tcpProxy.ts:44

Properties

events

Readonly events: EventEmitter<TcpProxyEvents, any>

Defined in

src/network/tcpProxy.ts:38

Methods

listen

listen(port, abort?): Promise<void>

Start the proxy in listening mode

Parameters

NameTypeDescription
portnumberThe port number to use on the requestor
abort?AbortControllerThe abort controller to use in order to control cancelling requests

Returns

Promise<void>

Defined in

src/network/tcpProxy.ts:134


close

close(): Promise<void>

Gracefully close the proxy

Returns

Promise<void>

Defined in

src/network/tcpProxy.ts:163