Interface MicroBootstrapFlow<Bootstrap>
- All Superinterfaces:
ExternalSettingAware
- All Known Implementing Classes:
TcpMicroBootstrapFlow, WebSocketMicroBootstrapFlow
The startup process for a server that connects with real players.
Developers can use this interface to orchestrate the server, with orchestration divided into two phases: build time and new connection time. You can also selectively override the process methods to customize the business logic for your own projects. The framework provides implementations for TCP, WebSocket, and UDP.
The execution order of the interface methods is:
1. The execution flow for [Build Time], where createFlow calls the option and channelInitializer methods. 1.1 option 1.2 channelInitializer 2. The execution flow for [New Connection Time], where pipelineFlow calls pipelineCodec, pipelineIdle, and pipelineCustom. 2.1 pipelineCodec 2.2 pipelineIdle 2.3 pipelineCustom
- Author:
- 渔民小镇
- date:
- 2023-05-28
-
Method Summary
Modifier and TypeMethodDescriptionvoidchannelInitializer(Bootstrap bootstrap) Arranges some business orchestration for the server.voidConfigures some options for the server.voidpipelineCodec(PipelineContext context) Orchestrates the encoding and decoding logic.voidpipelineCustom(PipelineContext context) Custom business orchestration (to arrange some business logic for the server).default voidpipelineFlow(PipelineContext pipelineContext) The execution flow when a new connection is established.voidpipelineIdle(PipelineContext context) Orchestrates the heartbeat-related logic.Methods inherited from interface ExternalSettingAware
setExternalSetting
-
Method Details
-
option
Configures some options for the server. The server is not yet started at this point.- Parameters:
bootstrap- The server bootstrap.
-
channelInitializer
Arranges some business orchestration for the server. The server is not yet started at this point.- Parameters:
bootstrap- The server bootstrap.
-
pipelineFlow
The execution flow when a new connection is established.Typically, we can divide the implementation within ChannelInitializer into three parts: 1. pipelineCodec: Encoding and decoding. 2. pipelineIdle: Heartbeat-related logic. 3. pipelineCustom: Custom business orchestration (in most cases, just overriding pipelineCustom is enough for strong extension).
- Parameters:
pipelineContext- context
-
pipelineCodec
Orchestrates the encoding and decoding logic.- Parameters:
context- The PipelineContext.
-
pipelineIdle
Orchestrates the heartbeat-related logic.- Parameters:
context- The PipelineContext.
-
pipelineCustom
Custom business orchestration (to arrange some business logic for the server).- Parameters:
context- The PipelineContext.
-