Connection
A connection to a peer. Close it with close when finished; operations after that return errors.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Connection():
Connection
Returns
Section titled “Returns”Connection
Methods
Section titled “Methods”clearPollGroup()
Section titled “clearPollGroup()”clearPollGroup():
void
Removes the connection from its poll group.
Returns
Section titled “Returns”void
close()
Section titled “close()”close(
endReason?,debugMessage?,linger?):boolean
Closes the connection and frees its Steam handle. Calling it again returns false.
Parameters
Section titled “Parameters”endReason?
Section titled “endReason?”number | null
Steam end reason code sent to the peer. Defaults to the generic application code.
debugMessage?
Section titled “debugMessage?”string | null
Optional diagnostic text sent to the peer
linger?
Section titled “linger?”boolean | null
When true, Steam tries to send pending reliable data before closing
Returns
Section titled “Returns”boolean
false when Steam could not close the connection
flush()
Section titled “flush()”flush():
void
Sends messages that Nagle’s algorithm is holding back, as soon as possible.
Returns
Section titled “Returns”void
getInfo()
Section titled “getInfo()”getInfo():
ConnectionInfo
Returns the state, remote SteamID and end reason of the connection.
Returns
Section titled “Returns”getRealtimeStatus()
Section titled “getRealtimeStatus()”getRealtimeStatus():
ConnectionRealtimeStatus
Returns live statistics: ping, link quality and bandwidth.
Returns
Section titled “Returns”getUserData()
Section titled “getUserData()”getUserData():
bigint
Returns the user data set with setUserData, or -1 when none is set.
Returns
Section titled “Returns”bigint
receive()
Section titled “receive()”receive(
batchSize):Buffer[]
Receives up to batchSize messages. Returns an empty array when none are waiting.
Parameters
Section titled “Parameters”batchSize
Section titled “batchSize”number
Returns
Section titled “Returns”Buffer[]
send()
Section titled “send()”send(
data,sendFlags):void
Sends one message to the peer.
Parameters
Section titled “Parameters”Buffer
sendFlags
Section titled “sendFlags”number
Bitmask of Steam’s k_nSteamNetworkingSend_* values, for example 8 for reliable or 0 for unreliable
Returns
Section titled “Returns”void
setName()
Section titled “setName()”setName(
name):void
Sets a name for the connection, used mostly for debugging.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
setPollGroup()
Section titled “setPollGroup()”setPollGroup(
pollGroup):void
Adds the connection to a poll group, so its messages come out of PollGroup.receiveMessages.
Parameters
Section titled “Parameters”pollGroup
Section titled “pollGroup”Returns
Section titled “Returns”void
setUserData()
Section titled “setUserData()”setUserData(
userData):void
Stores user data on the connection. Steam returns it in events and message info.
Parameters
Section titled “Parameters”userData
Section titled “userData”bigint
Returns
Section titled “Returns”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.
© 2026 HagiCode | Powered By hagilight-starlight@0.23.0 | Branch: main | Commit: 7164ec7 | Built:
