Server communication¶
This module is the transport layer between the client and the game server: it posts request bodies and hands back each response as an open stream for the caller to read. It knows neither what a request means nor the game state's shape. Building requests and reading responses is com.stratkit.game-state-loader's GameServerClient, using com.stratkit.client-api.
Services¶
Multiple services are provided by this module each of which are stored in a wrapping container as ecs singletons.
HttpClient¶
Used to send HTTP request and receiving HTTP responses. It is recommended to instantiate this class only once and reuse it during the lifetime of an application. So this instance is exposed to access it from outside this module.
Reference: System.Net.Http.HttpClient
GameServerTransport¶
GameServerTransport.PostAsync posts a body and returns an OpenResponse once the response is a success. With streamBody the body is still arriving when it returns. Read it once, then dispose the response. It owns retries (RetryHttpClient), cancellation when the world goes down, the status check, and the debug hooks in HttpResponseUtil. GameServerTransport.IsRecoverableFailure tells a caller whether a failed request is worth repeating.
The singleton is GameServerTransportContainer.
Inspecting messages in-editor¶
Use with Odin -> Inspector -> Static Inspector and find the class EditorServerMessageLogger in order to visualize all requests and responses with a game server. They're matched by requestId and sorted by request time.