{"id":15103677,"url":"https://github.com/avionik-world/netty-kit","last_synced_at":"2025-08-19T05:32:18.401Z","repository":{"id":228890600,"uuid":"775195847","full_name":"avionik-world/netty-kit","owner":"avionik-world","description":"Easy to create a NettyServer and a NettyClient","archived":false,"fork":false,"pushed_at":"2024-03-20T23:51:36.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-10-31T04:21:49.202Z","etag":null,"topics":["clientserverapi","netty"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/avionik-world.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-03-20T23:49:20.000Z","updated_at":"2024-03-20T23:50:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"b873c7ff-3d55-47ee-9cac-4e5a89cdc83d","html_url":"https://github.com/avionik-world/netty-kit","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"858d839e484da88c0ef7e88a727146b637dd0344"},"previous_names":["avionik-world/netty-kit"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avionik-world%2Fnetty-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avionik-world%2Fnetty-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avionik-world%2Fnetty-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avionik-world%2Fnetty-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avionik-world","download_url":"https://codeload.github.com/avionik-world/netty-kit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230325270,"owners_count":18208993,"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":["clientserverapi","netty"],"created_at":"2024-09-25T19:41:28.234Z","updated_at":"2024-12-18T18:41:53.369Z","avatar_url":"https://github.com/avionik-world.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Netty Kit 🛩️\nWith the NettyKit it is easy to create a NettyServer and a NettyClient. It is important to note that this project requires the client server API.\n\n## Using the Netty Kit in your plugin\n\n### Maven\n```xml\n\u003cdependencies\u003e\n \u003cdependency\u003e\n    \u003cgroupId\u003eworld.avionik\u003c/groupId\u003e\n    \u003cartifactId\u003enetty-kit\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.1\u003c/version\u003e\n    \u003cscope\u003eprovided\u003c/scope\u003e\n  \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\n### Gradle\n```groovy\ndependencies {\n    compileOnly 'world.avionik:netty-kit:1.0.1'\n}\n```\n\n## How to create a Netty Server\nYou can use these methods to create a new NettyServer. There are two ways to specify the host and port. Once in a config or as a system environment variable \n\n``` kotlin\nNettyServerConfigurator(NettyServerSettings.fromConfig())  // Here you can also use fromEnv() here\n    .withPackets(PacketOutTesting::class.java, PacketInSomeCoolThings::class.java)\n    .start()\n```\n\nNow you have the [NettyServerHandler](https://github.com/avionik-world/netty-kit/blob/master/src/main/kotlin/world/avionik/nettykit/server/NettyServerHandler.kt). You can then use this handler to send packets to the clients. Here is a small example:\n``` kotlin\nval nettyServerHandler = NettyServerConfigurator(NettyServerSettings.fromConfig())\n    .withPackets(PacketOutTesting::class.java, PacketInSomeCoolThings::class.java)\n    .start()\n\nval packet = PacketOutTesting()\n\nnettyServerHandler.sendPacket(packet, \"netty-client\") // Here you get a CommunicationPromise as a return type\n    .addResultListener { println(\"success\") }\n    .addFailureListener { println(\"failed\") }\n\n// And this is how you send a packet to all connected Netty clients\nnettyServerHandler.sendPacketToAllClients(packet)\n```\n\n## How to create a Netty Client\nIf you have already created the NettyServer, you now need the client. Here is how to create a Netty client:\n\n``` kotlin\n// And here, too, there are two options for the host and port settings.\nNettyClientConfigurator(NettyClientSettings.fromConfig(\"netty-client.yaml\"), \"ClientName\") // This is the name of the Netty client\n    .withPackets(PacketInTesting::class.java, PacketOutSomeCoolThings::class.java)\n    .withAutoReconnect() // This allows you to set the client to automatically reconnect in the event of a netty server shutdown\n    .start()\n```\n\nHere you have the option of sending a packet to the Netty server with the [NettyClientHandler](https://github.com/avionik-world/netty-kit/blob/master/src/main/kotlin/world/avionik/nettykit/client/NettyClientHandler.kt):\n``` kotlin\nval nettyClientHandler = NettyClientConfigurator(NettyClientSettings.fromConfig(\"netty-client.yaml\"), \"ClientName\")\n    .withPackets(PacketInTesting::class.java, PacketOutSomeCoolThings::class.java)\n    .withAutoReconnect()\n    .start()\n\nval packet = PacketOutSomeCoolThings()\nnettyClientHandler.sendPacketToServer(packet)\n    .addResultListener { println(\"success\") }\n    .addFailureListener { println(\"failed\") }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favionik-world%2Fnetty-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favionik-world%2Fnetty-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favionik-world%2Fnetty-kit/lists"}