Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/web3/types/http.d.ts>Agent

Deno / TypeScript to Ethereum Connector
Latest
class Agent
import { Agent } from "https://deno.land/x/web3@v0.11.1/types/http.d.ts";

Constructors

new
Agent(opts?: AgentOptions)

Properties

readonly
freeSockets: any

An object which contains arrays of sockets currently awaiting use by the agent when keepAlive is enabled. Do not modify.

Sockets in the freeSockets list will be automatically destroyed and removed from the array on 'timeout'.

maxFreeSockets: number

By default set to 256. For agents with keepAlive enabled, this sets the maximum number of sockets that will be left open in the free state.

maxSockets: number

By default set to Infinity. Determines how many concurrent sockets the agent can have open per origin. Origin is the returned value of agent.getName().

maxTotalSockets: number

By default set to Infinity. Determines how many concurrent sockets the agent can have open. Unlike maxSockets, this parameter applies across all origins.

readonly
requests: any

An object which contains queues of requests that have not yet been assigned to sockets. Do not modify.

readonly
sockets: any

An object which contains arrays of sockets currently in use by the agent. Do not modify.

Methods

destroy(): void

Destroy any sockets that are currently in use by the agent.

It is usually not necessary to do this. However, if using an agent with keepAlive enabled, then it is best to explicitly shut down the agent when it is no longer needed. Otherwise, sockets might stay open for quite a long time before the server terminates them.