steam-min-cpp
Loading...
Searching...
No Matches
Steam::SteamClient Class Reference

Public Member Functions

Construction and Destruction

Client lifetime management.

 SteamClient (std::unique_ptr< Steam::Networking::IConnection > connection)
 Construct a Steam client using a specific connection implementation.
 ~SteamClient ()
 Destructor Ensures the client disconnects from CM servers before destruction.
Connection Management

Establishing and terminating CM sessions.

void connect ()
 Establish a session with a Steam CM server.
void disconnect ()
 Disconnect from the current Steam CM server session.
bool is_connected () const
 Check whether the client is currently connected.
Event System

Register callbacks for events emitted by the CM client.

template<typename Type, typename Fn>
void on (Fn &&callback)
 Registers a callback for a specific CMClient event.
Command Execution

Sending requests to the Steam CM server.

template<typename Request>
void execute (const Request &req)
 Send a command to the Steam CM server.

Constructor & Destructor Documentation

◆ SteamClient()

Steam::SteamClient::SteamClient ( std::unique_ptr< Steam::Networking::IConnection > connection)

Construct a Steam client using a specific connection implementation.

Parameters
connectionConnection backend used for communicating with Steam CM servers.

Member Function Documentation

◆ execute()

template<typename Request>
void Steam::SteamClient::execute ( const Request & req)
inline

Send a command to the Steam CM server.

Routes a request object through the underlying CMClient command dispatcher. Most commands produce a response message, which can be handled by registering an event listener with on.

Template Parameters
RequestType representing the CM request message.
Parameters
reqRequest structure to send to the server.

◆ is_connected()

bool Steam::SteamClient::is_connected ( ) const

Check whether the client is currently connected.

Returns
True if a CM session is currently active.

◆ on()

template<typename Type, typename Fn>
void Steam::SteamClient::on ( Fn && callback)
inline

Registers a callback for a specific CMClient event.

Subscribes a handler to the underlying CMClient dispatch system. The callback will be invoked whenever an event of type Event is emitted by the internal network client.

Template Parameters
TypeEvent type to listen for.
FnCallable type used as the event handler.
Parameters
callbackCallable invoked when the specified event occurs. The callable should accept the emitted event object.

The documentation for this class was generated from the following file: