SteamClient

class SteamClient @JvmOverloads constructor(configuration: SteamConfiguration? = SteamConfiguration.createDefault(), defaultScope: CoroutineScope = CoroutineScope(Dispatchers.IO + SupervisorJob())) : CMClient

Represents a single client that connects to the Steam3 network. This class is also responsible for handling the registration of client message handlers and callbacks.

Parameters

configuration

The configuration to use for this client.

Constructors

Link copied to clipboard
constructor(configuration: SteamConfiguration? = SteamConfiguration.createDefault(), defaultScope: CoroutineScope = CoroutineScope(Dispatchers.IO + SupervisorJob()))

Initializes a new instance of the SteamClient class with a specific configuration.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Handler used for authenticating on Steam.

Link copied to clipboard
@Nullable
@get:Nullable
val cellID: @Nullable Int?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@Nullable
@get:Nullable
val ipCountryCode: @Nullable String?
Link copied to clipboard
@Nullable
@get:Nullable
val publicIP: @Nullable InetAddress?
Link copied to clipboard
@Nullable
@get:Nullable
val sessionID: @Nullable Int?
Link copied to clipboard
Link copied to clipboard
@Nullable
@get:Nullable
val steamID: @Nullable SteamID?

Functions

Link copied to clipboard

Adds a new handler to the internal list of message handlers.

Link copied to clipboard
Link copied to clipboard
open fun connect()

Connects this client to a Steam3 server. This begins the process of connecting and encrypting the data channel between the client and the server. Results are returned asynchronously in a ConnectedCallback. If the server that SteamKit attempts to connect to is down, a DisconnectedCallback will be posted instead. SteamKit will not attempt to reconnect to Steam, you must handle this callback and call Connect again preferably after a short delay. SteamKit will randomly select a CM server from its internal list.

open fun connect(cmServer: ServerRecord)

Connects this client to a Steam3 server. This begins the process of connecting and encrypting the data channel between the client and the server. Results are returned asynchronously in a ConnectedCallback. If the server that SteamKit attempts to connect to is down, a DisconnectedCallback will be posted instead. SteamKit will not attempt to reconnect to Steam, you must handle this callback and call Connect again preferably after a short delay.

Link copied to clipboard
open fun disconnect()

Disconnects this client.

Link copied to clipboard

Gets the next callback object in the queue, and removes it.

Link copied to clipboard

Gets or sets the connection timeout used when connecting to the Steam server.

Link copied to clipboard
@Nullable
open fun getCurrentEndpoint(): @Nullable InetSocketAddress?

Returns the current endpoint this client is connected to.

Link copied to clipboard
inline fun <T : ClientMsgHandler> getHandler(): T?

Kotlin Helper: Returns a registered handler.

fun <T : ClientMsgHandler> getHandler(type: Class<T>): T?

Returns a registered handler.

Link copied to clipboard
@Nullable
open fun getLocalIP(): @Nullable InetAddress?

Returns the local IP of this client.

Link copied to clipboard

Returns the next available JobID for job based messages.

Link copied to clipboard
Link copied to clipboard
open fun getUniverse(): EUniverse

Gets the universe of this client.

Link copied to clipboard
open fun isConnected(): Boolean

Gets a value indicating whether this instance is isConnected to the remote CM server.

Link copied to clipboard

Gets a value indicating whether isConnected and connection is not connected to the remote CM server. Inverse alternative to isConnected

Link copied to clipboard

Posts a callback to the queue. This is normally used directly by client message handlers.

Link copied to clipboard
open fun receiveTestPacketMsg(packetMsg: IPacketMsg)

Debugging only method: Do not use this directly.

Link copied to clipboard

Removes a registered handler.

Removes a registered handler by name.

Link copied to clipboard
open fun send(msg: IClientMsg)

Sends the specified client message to the server. This method automatically assigns the correct SessionID and SteamID of the message.

Link copied to clipboard
open fun setIsConnected(value: Boolean)

Debugging only method: Do not use this directly.

Link copied to clipboard
fun startJob(job: AsyncJob)
Link copied to clipboard

Blocks the calling thread until a callback object is posted to the queue, and removes it.

Blocks the calling thread until a callback object is posted to the queue, or null after the timeout has elapsed.

Link copied to clipboard

Asynchronously awaits until a callback object is posted to the queue, and removes it.