NetworkService

The primary network service implementation that brings all the necessary components together in a single "god" object.

Parameters

R

the receiver type for the incoming game message consumers, typically a player

rsaKeyPair

the key pair for RSA to decode login blocks

js5Configuration

the configuration used by the JS5 service to determine the exact conditions for serving any connected clients

js5GroupProvider

the provider for any JS5 requests that the client makes

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val gameMessageConsumerRepositoryProvider: GameMessageConsumerRepositoryProvider<R>

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.

Link copied to clipboard
val huffmanCodecProvider: HuffmanCodecProvider

the provider for Huffman codecs, used to compress the text in some packets

Link copied to clipboard
val npcAvatarFactory: NpcAvatarFactory

the avatar factory for NPCs responsible for tracking anything necessary to represent a NPC to the client

Link copied to clipboard
val npcInfoProtocol: NpcInfoProtocol

the protocol responsible for tracking and computing everything related to the NPC info packet for every player

Link copied to clipboard
val playerInfoProtocol: PlayerInfoProtocol

the protocol responsible for tracking and computing player info for all the players in the game

Link copied to clipboard
val worldEntityAvatarFactory: WorldEntityAvatarFactory
Link copied to clipboard
val worldEntityInfoProtocol: WorldEntityProtocol

Functions

Link copied to clipboard
fun <T : ZoneProt> computeUpdateZonePartialEnclosedCache(events: List<T>): EnumMap<OldSchoolClientType, ByteBuf>

Computes the buffer for the update zone partial enclosed packet payload for a given list of events, for every platform that is registered.

Link copied to clipboard
fun isSupported(clientType: OldSchoolClientType): Boolean

Checks whether the provided clientType is supported by the service.

Link copied to clipboard

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.

Link copied to clipboard
fun shutdown()
Link copied to clipboard

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.