Skip to content

Connection

A connection to a peer. Close it with close when finished; operations after that return errors.

new Connection(): Connection

Connection

clearPollGroup(): void

Removes the connection from its poll group.

void


close(endReason?, debugMessage?, linger?): boolean

Closes the connection and frees its Steam handle. Calling it again returns false.

number | null

Steam end reason code sent to the peer. Defaults to the generic application code.

string | null

Optional diagnostic text sent to the peer

boolean | null

When true, Steam tries to send pending reliable data before closing

boolean

false when Steam could not close the connection


flush(): void

Sends messages that Nagle’s algorithm is holding back, as soon as possible.

void


getInfo(): ConnectionInfo

Returns the state, remote SteamID and end reason of the connection.

ConnectionInfo


getRealtimeStatus(): ConnectionRealtimeStatus

Returns live statistics: ping, link quality and bandwidth.

ConnectionRealtimeStatus


getUserData(): bigint

Returns the user data set with setUserData, or -1 when none is set.

bigint


receive(batchSize): Buffer[]

Receives up to batchSize messages. Returns an empty array when none are waiting.

number

Buffer[]


send(data, sendFlags): void

Sends one message to the peer.

Buffer

number

Bitmask of Steam’s k_nSteamNetworkingSend_* values, for example 8 for reliable or 0 for unreliable

void


setName(name): void

Sets a name for the connection, used mostly for debugging.

string

void


setPollGroup(pollGroup): void

Adds the connection to a poll group, so its messages come out of PollGroup.receiveMessages.

PollGroup

void


setUserData(userData): void

Stores user data on the connection. Steam returns it in events and message info.

bigint

void

Turn ideas into shipped software.

HagiCode is an agentic coding workspace. OpenSpec workflows plan the change, multi-agent execution carries it out, and Hero Scenario makes the long run visible, so ideas become shipped software.

Smart
OpenSpec workflows turn intent into a path from proposal to shipped change.
Efficient
Multi-agent execution runs research, build, and review in parallel.
Fun
Rich UI interactions make planning, agent work, and projects easier to follow.