subscribe Service Response
Registers a callback to receive service responses from Steam's unified messaging system.
This method creates a service subscription that listens for specific responses from a Steam service. When a response is received, it validates the response type and forwards it to the provided callback function if the types match. Unlike notifications, responses are typically used for request-response patterns in the Steam API.
Return
A Closeable subscription. Call Closeable.close to unsubscribe and clean up resources
Parameters
The type of Steam service to subscribe to (e.g., GameNotificationsClient)
The type of response message to receive
The class object representing the Steam service
The class object representing the response type
The callback function to be invoked when matching responses are received
See also
Example usage in Kotlin: val subscription = manager.subscribeServiceResponse( Player::class.java, CPlayer_GetGameBadgeLevels_Response.Builder::class.java ) { response -> println("Badge level: ${response.body.playerLevel}") }
Example usage in Java: Closeable subscription = manager.subscribeServiceResponse( Player.class, CPlayer_GetGameBadgeLevels_Response.Builder.class, response -> { System.out.println("Badge level: " + response.getBody().getPlayerLevel()); } );