Package com.iohao.net.external.core


package com.iohao.net.external.core
External Server - core

Responsibilities of the External Server

1. Maintain long connections with users (players)
2. Help developers abstract away communication and connection details
3. Supported connection methods: WebSocket, TCP, UDP
4. Forward user (player) requests to the Gateway
5. Dynamic scaling (adding or removing) of server instances
6. Feature extensions, such as: route existence detection, route permissions, UserSession management, heartbeats,
and future features like circuit breakers, rate limiting, load shedding (or graceful degradation), and user traffic statistics.

Extension Scenario

The External Server is primarily responsible for connections with users (players).
Suppose a single piece of hardware supports a maximum of 5000 user connections.
When the number of users reaches 7000, we can add another External Server to manage traffic and reduce load.

Due to the scalability and flexibility of the External Server, it can support concurrent online players ranging
from a few thousand to tens of millions.
This is because by increasing the number of External Servers, connection load balancing and traffic control
can be effectively managed, enabling the system to better withstand high concurrency pressure.

Switching, Support, and Extension of Connection Methods

The External Server already provides support for TCP, WebSocket, and UDP connection methods, and offers flexible ways
to switch between them.
TCP, WebSocket, and UDP connection methods can be seamlessly integrated with the business code.
Developers can use a single set of business code, without any modification, to simultaneously support multiple communication protocols.

If you want to switch to a different connection method, you only need to change the corresponding enumeration, which is very simple.
Furthermore, in addition to easily switching various connection methods, it can simultaneously support and allow multiple
connection methods to coexist within the same application.

Connection methods are extensible, and extension is also simple. This means that if KCP support is added later,
switching the connection method of existing projects, such as TCP, WebSocket, or UDP, to KCP will also be simple.
Author:
渔民小镇
date:
2023-04-28