{"id":27289279,"url":"https://github.com/squarecodefx/paralyzed","last_synced_at":"2026-04-30T09:36:32.729Z","repository":{"id":287277952,"uuid":"964206967","full_name":"SquareCodeFX/Paralyzed","owner":"SquareCodeFX","description":"Paralyzed is a high-performance, scalable client-server communication framework built on Netty. It provides a robust packet-based communication system with type safety, validation, and efficient serialization.","archived":false,"fork":false,"pushed_at":"2025-04-10T21:16:41.000Z","size":84,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T21:18:00.330Z","etag":null,"topics":["api","async","client","communication","efficient","fast","netty","scalable","server"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SquareCodeFX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-10T21:16:05.000Z","updated_at":"2025-04-10T21:17:36.000Z","dependencies_parsed_at":"2025-04-10T22:25:59.421Z","dependency_job_id":"9d00d993-923f-4139-b823-7c610f285059","html_url":"https://github.com/SquareCodeFX/Paralyzed","commit_stats":null,"previous_names":["squarecodefx/paralyzed"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SquareCodeFX%2FParalyzed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SquareCodeFX%2FParalyzed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SquareCodeFX%2FParalyzed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SquareCodeFX%2FParalyzed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SquareCodeFX","download_url":"https://codeload.github.com/SquareCodeFX/Paralyzed/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248480445,"owners_count":21110938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","async","client","communication","efficient","fast","netty","scalable","server"],"created_at":"2025-04-11T21:18:04.118Z","updated_at":"2026-04-30T09:36:32.685Z","avatar_url":"https://github.com/SquareCodeFX.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Paralyzed\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n[![Java](https://img.shields.io/badge/java-11%2B-orange.svg)](https://www.oracle.com/java/technologies/javase-jdk11-downloads.html)\n[![Netty](https://img.shields.io/badge/netty-4.1.100-green.svg)](https://netty.io/)\n[![Gson](https://img.shields.io/badge/gson-2.10.1-yellow.svg)](https://github.com/google/gson)\n\nParalyzed is a high-performance, scalable client-server communication framework built on Netty. It provides a robust packet-based communication system with type safety, validation, and efficient serialization.\n\n## Features\n\n- **Modular Architecture**: Separate API, client, and server modules for clean dependency management\n- **Type-Safe Packet System**: Enumeration-based packet types with validation\n- **Efficient Serialization**: JSON-based serialization using Gson for maximum compatibility\n- **Session Management**: Robust client session tracking with timeout handling\n- **Flexible Packet Handling**: Registry-based packet handler system for easy extensibility\n- **Builder Pattern**: Fluent API for creating packets\n- **Comprehensive Validation**: Built-in validation for all packets\n- **Error Handling**: Detailed error reporting and exception handling\n- **Logging**: Comprehensive logging throughout the codebase\n\n## Modules\n\n### API Module\n\nThe API module contains the core interfaces and classes for packet definitions, serialization, and validation. This module is shared between the client and server.\n\nKey components:\n- `Packet` interface: Base interface for all packets\n- `PacketType` enum: Type-safe packet type definitions\n- `PacketSerializer`: JSON serialization/deserialization for packets\n- `PacketRegistry`: Registry for mapping packet types to classes\n- `Validatable` interface: Interface for objects that can be validated\n\n### Server Module\n\nThe server module provides a Netty-based server implementation for receiving and processing packets.\n\nKey components:\n- `NettyServer`: Main server implementation\n- `PacketHandler`: Interface for handling incoming packets\n- `SessionManager`: Manages client sessions\n- `PacketHandlerRegistry`: Registry for packet type handlers\n\n### Client Module\n\nThe client module provides a Netty-based client implementation for sending packets and receiving responses.\n\nKey components:\n- `NettyClient`: Main client implementation\n- `ClientPacketHandler`: Handles responses from the server\n- `ClientApplication`: Example client application\n\n## Getting Started\n\n### Prerequisites\n\n- Java 11 or higher\n- Gradle 7.0 or higher\n\n### Building the Project\n\n```bash\n./gradlew build\n```\n\n### Running the Server\n\n```bash\n./gradlew server:run\n```\n\nOr with custom port:\n\n```bash\n./gradlew server:run --args=\"8888\"\n```\n\n### Running the Client\n\n```bash\n./gradlew client:run\n```\n\nOr with custom host and port:\n\n```bash\n./gradlew client:run --args=\"localhost 8888\"\n```\n\n### Running the Examples\n\nThe project includes several examples demonstrating how to use the Paralyzed framework:\n\n#### Simple Server Example\n\n```bash\n./gradlew examples:runServer\n```\n\n#### Simple Client Example\n\n```bash\n./gradlew examples:runClient\n```\n\n#### Custom Packet Example\n\n```bash\n./gradlew examples:runCustomPacket\n```\n\nThese examples demonstrate basic usage, client-server communication, and how to create custom packet types and handlers.\n\n## Usage Examples\n\n### Creating a Custom Packet\n\n```java\npublic class CustomInPacket implements InPacket {\n    private final String transactionId;\n    private final String customData;\n\n    public CustomInPacket(String transactionId, String customData) {\n        this.transactionId = transactionId;\n        this.customData = customData;\n    }\n\n    @Override\n    public String getTransactionId() {\n        return transactionId;\n    }\n\n    public String getCustomData() {\n        return customData;\n    }\n\n    @Override\n    public PacketType getType() {\n        return PacketType.CUSTOM_IN_PACKET; // Add this to PacketType enum\n    }\n\n    @Override\n    public void validate() throws ValidationException {\n        if (transactionId == null || transactionId.isEmpty()) {\n            throw new ValidationException(\"Transaction ID cannot be null or empty\");\n        }\n        if (customData == null) {\n            throw new ValidationException(\"Custom data cannot be null\");\n        }\n    }\n}\n```\n\n### Registering a Custom Packet Type\n\n```java\n// In PacketType enum\npublic enum PacketType {\n    // Existing types...\n    CUSTOM_IN_PACKET(\"CUSTOM_IN_PACKET\"),\n    // Other types...\n}\n\n// In PacketRegistry\nstatic {\n    // Register built-in packet types\n    register(PacketType.OUT_PACKET, OutPacket.class);\n    register(PacketType.SIMPLE_IN_PACKET, SimpleInPacket.class);\n    register(PacketType.CUSTOM_IN_PACKET, CustomInPacket.class);\n}\n```\n\n### Creating a Custom Packet Handler\n\n```java\npublic class CustomInPacketHandler implements PacketTypeHandler\u003cCustomInPacket\u003e {\n    @Override\n    public OutPacket handle(CustomInPacket packet) {\n        try {\n            // Validate the packet\n            packet.validate();\n\n            // Process the custom data\n            String customData = packet.getCustomData();\n            String response = \"Processed: \" + customData;\n\n            // Return a success response\n            return OutPacket.Builder.success(packet.getTransactionId(), response);\n        } catch (Exception e) {\n            // Return an error response\n            return OutPacket.Builder.error(packet.getTransactionId(), \"Error: \" + e.getMessage());\n        }\n    }\n}\n```\n\n### Registering a Custom Packet Handler\n\n```java\n// In your server initialization code\nPacketHandler packetHandler = new SimplePacketHandler();\npacketHandler.registerHandler(PacketType.CUSTOM_IN_PACKET, new CustomInPacketHandler());\n```\n\n### Sending a Packet from the Client\n\n```java\n// Create a client\nNettyClient client = new NettyClient(\"localhost\", 8888);\nclient.connect();\n\n// Create a packet\nString transactionId = TransactionIdGenerator.generateId();\nCustomInPacket packet = new CustomInPacket(transactionId, \"Hello, server!\");\n\n// Send the packet and get the response\nCompletableFuture\u003cOutPacket\u003e future = client.sendPacket(packet);\nOutPacket response = future.get();\n\n// Process the response\nif (response.isSuccess()) {\n    System.out.println(\"Response: \" + response.getResponse());\n} else {\n    System.err.println(\"Error: \" + response.getErrorMessage());\n}\n\n// Shutdown the client\nclient.shutdown();\n```\n\n## Advanced Configuration\n\n### Server Configuration\n\nThe server can be configured using the `ServerConfig` class:\n\n```java\nServerConfig config = new ServerConfig()\n    .setPort(8888)\n    .setBossThreads(1)\n    .setWorkerThreads(4)\n    .setSessionTimeout(Duration.ofMinutes(30))\n    .setEnableSsl(true)\n    .setSslCertPath(\"/path/to/cert.pem\")\n    .setSslKeyPath(\"/path/to/key.pem\");\n\nPacketHandler packetHandler = new SimplePacketHandler();\nSessionManager sessionManager = new SessionManager(config);\nNettyServer server = new NettyServer(config.getPort(), packetHandler, sessionManager);\nserver.start();\n```\n\n### Client Configuration\n\nThe client can be configured with various options:\n\n```java\n// Create a client with custom options\nNettyClient client = new NettyClient(\"localhost\", 8888);\nclient.setConnectTimeout(Duration.ofSeconds(5));\nclient.setRequestTimeout(Duration.ofSeconds(10));\nclient.setAutoReconnect(true);\nclient.setMaxReconnectAttempts(3);\nclient.connect();\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- [Netty](https://netty.io/) - The network application framework\n- [Gson](https://github.com/google/gson) - JSON serialization/deserialization library\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquarecodefx%2Fparalyzed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsquarecodefx%2Fparalyzed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquarecodefx%2Fparalyzed/lists"}