feat!: big feature changes

BREAKING CHANGES:
- Heartbeating removed
- `config.consoleLogLevel` -> `config.logLevel`

NEW FEATURES:
- Training messages
- Sequence number system
- WebSocket close codes used instead of disconnect packets

FIXES:
- Improved error handling
- Some performance improvements
- Made code more clean
- Updated dependencies
This commit is contained in:
PalmDevs
2024-03-28 21:41:59 +07:00
parent 77f1a9cb3e
commit b3b7723b4f
33 changed files with 562 additions and 506 deletions

View File

@@ -3,29 +3,33 @@
*/
enum DisconnectReason {
/**
* Unknown reason
* The client disconnected on its own (**CLIENT-ONLY**)
*/
Generic = 1,
/**
* The client did not respond in time
*/
TimedOut = 2,
PlannedDisconnect = 1000,
/**
* The client sent an invalid packet (unserializable or invalid JSON)
*/
InvalidPacket = 3,
InvalidPacket = 1007,
/**
* The server has encountered an internal error
*/
ServerError = 4,
ServerError = 1011,
/**
* The client had never connected to the server (**CLIENT-ONLY**)
* Unknown reason
*/
NeverConnected = 5,
Generic = 4000,
/**
* The client disconnected on its own (**CLIENT-ONLY**)
* The client did not respond with a heartbeat in time
*/
PlannedDisconnect = 6,
TimedOut = 4001,
/**
* The receiving end didn't have an open socket
*/
NoOpenSocket = 4003,
/**
* The client was not ready in time (**CLIENT-ONLY**)
*/
TooSlow = 4002,
}
export default DisconnectReason