{"id":26133745,"url":"https://github.com/JMagician/Magician","last_synced_at":"2025-03-10T23:03:31.196Z","repository":{"id":143825211,"uuid":"356606740","full_name":"JMagician/Magician","owner":"JMagician","description":"Magician is a small HTTP service package based on Netty that makes it very easy to start an http service, and also supports WebSocket, using annotated configuration Handler, If you want to develop an http service with netty but find it cumbersome, then Magician may help you.","archived":false,"fork":false,"pushed_at":"2025-03-08T15:17:57.000Z","size":364,"stargazers_count":108,"open_issues_count":0,"forks_count":15,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-08T16:22:50.359Z","etag":null,"topics":["framework","http","java","magician","network","nio","tcp","udp","websocket"],"latest_commit_sha":null,"homepage":"https://magician-io.com","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/JMagician.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":null,"patreon":"yuyenews","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://afdian.com/a/magicianio","https://www.paypal.me/yuye666"]}},"created_at":"2021-04-10T14:31:28.000Z","updated_at":"2025-03-08T15:18:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"34d9bddd-e328-4835-bb18-c12493f01c00","html_url":"https://github.com/JMagician/Magician","commit_stats":null,"previous_names":["jmagician/magician-http","jmagician/magician"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JMagician%2FMagician","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JMagician%2FMagician/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JMagician%2FMagician/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JMagician%2FMagician/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JMagician","download_url":"https://codeload.github.com/JMagician/Magician/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242940018,"owners_count":20209883,"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":["framework","http","java","magician","network","nio","tcp","udp","websocket"],"created_at":"2025-03-10T23:02:06.730Z","updated_at":"2025-03-10T23:03:31.189Z","avatar_url":"https://github.com/JMagician.png","language":"Java","funding_links":["https://patreon.com/yuyenews","https://afdian.com/a/magicianio","https://www.paypal.me/yuye666"],"categories":["Java","网络编程"],"sub_categories":[],"readme":"\u003ch1\u003e \n    \u003ca href=\"https://magician-io.com\"\u003eMagician\u003c/a\u003e ·\n    \u003cimg src=\"https://img.shields.io/badge/licenes-MIT-brightgreen.svg\"/\u003e\n    \u003cimg src=\"https://img.shields.io/badge/jdk-8+-brightgreen.svg\"/\u003e\n    \u003cimg src=\"https://img.shields.io/badge/maven-3.5.4+-brightgreen.svg\"/\u003e\n    \u003cimg src=\"https://img.shields.io/badge/release-master-brightgreen.svg\"/\u003e\n\u003c/h1\u003e\n\nMagician is a small HTTP service package based on Netty that makes it very easy to start an http service, and also supports WebSocket, using annotated configuration Handler.\n\nIf you want to develop an http service with netty but find it cumbersome, then Magician may help you.\n\nIn addition, we provide many other components that make up a toolkit that will work well for you in blockchain and web development.\n\n## Running environment\n\nJDK8+\n\n## Documentation\n\n[https://github.com/JMagician/Magician/blob/master/Document.md](https://github.com/JMagician/Magician/blob/master/Document.md)\n\n## Example\n\n### Importing dependencies\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.yuyenews\u003c/groupId\u003e\n    \u003cartifactId\u003eMagician\u003c/artifactId\u003e\n    \u003cversion\u003e2.0.7\u003c/version\u003e\n\u003c/dependency\u003e\n\n\u003c!-- This is the logging package, you must have it or the console will not see anything, any logging package that can bridge with slf4j is supported --\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.slf4j\u003c/groupId\u003e\n    \u003cartifactId\u003eslf4j-jdk14\u003c/artifactId\u003e\n    \u003cversion\u003e1.7.12\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Creating an http service\n\nCreate a Handler\n\n```java\n@HttpHandler(path=\"/\")\npublic class DemoHandler implements HttpBaseHandler {\n\n    @Override\n    public void request(MagicianRequest magicianRequest, MagicianResponse response) {\n        // response data\n        magicianRequest.getResponse()\n                .sendJson(200, \"{'status':'ok'}\");\n    }\n}\n```\n\nStart the http service\n\n```java\nMagician.createHttp()\n    .scan(\"handler所在的包名\")\n    .bind(8080);\n```\n\n### Creating WebSocket\n\n```java\n@WebSocketHandler(path = \"/websocket\")\npublic class DemoSocketHandler implements WebSocketBaseHandler {\n   \n    @Override\n    public void onOpen(WebSocketSession webSocketSession) {\n     \n    }\n   \n    @Override\n    public void onClose(WebSocketSession webSocketSession) {\n        \n    }\n\n    @Override\n    public void onMessage(WebSocketSession webSocketSession, byte[] message) {\n\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJMagician%2FMagician","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJMagician%2FMagician","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJMagician%2FMagician/lists"}