ISteamNetworkingMessages

Note

This documentation is auto-generated. Methods marked with 🤖 are automatically generated bindings. Methods marked with ✍️ are manually implemented and methods marked with ✋ are currently not implemented.

Note

This interface can be accessed has multiple accessors (e.g. a GameServer variant), the documentation shows NetworkingMessages_SteamAPI everywhere but it can also be accessed with GameServerNetworkingMessages_SteamAPI.

List of Functions

List of Callbacks

Function Reference

NetworkingMessages.AcceptSessionWithUser(identityRemote)

🤖 Auto-generated binding

Parameters:

identityRemote – (SteamNetworkingIdentity)

Returns:

(bool) Return value

SteamWorks:

AcceptSessionWithUser

Example:

function Steam.NetworkingMessages.OnSteamNetworkingMessagesSessionRequest(data)
    Steam.NetworkingMessages.AcceptSessionWithUser(data.m_identityRemote)
end
NetworkingMessages.CloseChannelWithUser(identityRemote, nLocalChannel)

🤖 Auto-generated binding

Parameters:
Returns:

(bool) Return value

SteamWorks:

CloseChannelWithUser

NetworkingMessages.CloseSessionWithUser(identityRemote)

🤖 Auto-generated binding

Parameters:

identityRemote – (SteamNetworkingIdentity)

Returns:

(bool) Return value

SteamWorks:

CloseSessionWithUser

Example:

local identity = Steam.newSteamNetworkingIdentity {}
identity:SetSteamID(steam_id)
Steam.NetworkingMessages.CloseSessionWithUser(identity)
NetworkingMessages.GetSessionConnectionInfo(identityRemote)

🤖 Auto-generated binding

Parameters:

identityRemote – (SteamNetworkingIdentity)

Returns:

(int - ESteamNetworkingConnectionState) Return value

Returns:

(SteamNetConnectionInfo_t) pConnectionInfo

Returns:

(SteamNetConnectionRealTimeStatus_t) pQuickStatus

SteamWorks:

GetSessionConnectionInfo

Signature differences from C++ API:

  • Parameter pConnectionInfo is not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.

  • Parameter pQuickStatus is not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.

NetworkingMessages.ReceiveMessagesOnChannel(nLocalChannel, nMaxMessages)

✍️ Manually implemented

Parameters:
  • nLocalChannel (int) – Local channel number to receive messages from.

  • nMaxMessages (int) – size of the buffer to allocate for ppOutMessages

Returns:

(int) Number of messages received.

Returns:

(SteamNetworkingMessage_t[]) Table of received messages, ppOutMessages. Remember to call Release on all of them after using.

SteamWorks:

ReceiveMessagesOnChannel

Receives messages sent via SendMessageToUser on the given channel number.

Signature differences from C++ API:

  • Parameter ppOutMessages is not a parameter in Lua — it is an output-only array in C++ and is returned as a second return value.

Example:

local count, msgs = Steam.NetworkingMessages.ReceiveMessagesOnChannel(0, 32)
for i = 1, count do
    local msg = msgs[i]
    processMessage(msg.m_identityPeer, msg.m_pData, msg.m_cbSize)
    msg:Release()
end
NetworkingMessages.SendMessageToUser(identityRemote, pubData, cubData, nSendFlags, nRemoteChannel)

🤖 Auto-generated binding

Parameters:
  • identityRemote – (SteamNetworkingIdentity)

  • pubData (str?) –

  • cubData (int) – size of the input array pubData

  • nSendFlags (int) –

  • nRemoteChannel (int) –

Returns:

(int - EResult) Return value

SteamWorks:

SendMessageToUser

Example:

local identity = Steam.newSteamNetworkingIdentity {}
identity:ParseString(send_to)
local data = serializePacket(send_data)
local result = Steam.NetworkingMessages.SendMessageToUser(
    identity, data, #data, Steam.k_nSteamNetworkingSend_Reliable, 0)
if result ~= Steam.k_EResultOK then
    print('Send failed:', result)
end

Callbacks

NetworkingMessages.OnSteamNetworkingMessagesSessionRequest()

Callback for SteamNetworkingMessagesSessionRequest_t

callback(data) receives:

  • data.m_identityRemote (SteamNetworkingIdentity)

NetworkingMessages.OnSteamNetworkingMessagesSessionFailed()

Callback for SteamNetworkingMessagesSessionFailed_t

callback(data) receives:

  • data.m_info (SteamNetConnectionInfo_t)

Example:

function Steam.NetworkingMessages.OnSteamNetworkingMessagesSessionFailed(data)
    print('Messages session failed:', data.m_info.m_eEndReason)
end