Network Service
The primary network service implementation that brings all the necessary components together in a single "god" object.
Parameters
the receiver type for the incoming game message consumers, typically a player
the key pair for RSA to decode login blocks
the configuration used by the JS5 service to determine the exact conditions for serving any connected clients
the provider for any JS5 requests that the client makes
Properties
the consumer repository for game messages. This is made public in case a blocking implementation is used, in which case the repository may be lazy-initialized into this library.
the provider for Huffman codecs, used to compress the text in some packets
the avatar factory for NPCs responsible for tracking anything necessary to represent a NPC to the client
the protocol responsible for tracking and computing everything related to the NPC info packet for every player
the protocol responsible for tracking and computing player info for all the players in the game
Functions
Computes the buffer for the update zone partial enclosed packet payload for a given list of events, for every platform that is registered.
Checks whether the provided clientType is supported by the service.
Clear any update zone partial enclosed prebuilt buffers that no longer have any references to them, meaning all the observers' netty channels have had these buffers written out. If a buffer is requested to be written over, but the socket closes or the player logs out before that can actually hit the encoder, the ref count will never be released. In these cases, a fail-safe mechanism is utilized to release the buffer after an entire minute has passed. Under normal circumstances, it should never get into a scenario where this is hit.
Starts the network service by binding the provided ports. If any of them fail, the service is shut down and the exception is propagated forward.