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
| Name | Type | Description |
|---|---|---|
wsUrl | string | The URL to the WebSocket implementing the communication transport layer |
appKey | string | The yagna app-key used to authenticate the WebSocket connection |
options | Partial<TcpProxyOptions> | Additional options of the proxy |
Returns
Defined in
Properties
events
• Readonly events: EventEmitter<TcpProxyEvents, any>
Defined in
Methods
listen
▸ listen(port, abort?): Promise<void>
Start the proxy in listening mode
Parameters
| Name | Type | Description |
|---|---|---|
port | number | The port number to use on the requestor |
abort? | AbortController | The abort controller to use in order to control cancelling requests |
Returns
Promise<void>
Defined in
close
▸ close(): Promise<void>
Gracefully close the proxy
Returns
Promise<void>