{"id":19714935,"url":"https://github.com/youngmonkeys/ezyfox-server-cpp-client","last_synced_at":"2025-07-24T01:39:04.858Z","repository":{"id":47292154,"uuid":"112422375","full_name":"youngmonkeys/ezyfox-server-cpp-client","owner":"youngmonkeys","description":"c++ client for ezyfox server","archived":false,"fork":false,"pushed_at":"2024-06-24T01:01:44.000Z","size":733,"stargazers_count":7,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-29T20:39:37.744Z","etag":null,"topics":["c","cpp","cpp-sockets","socket-client","tcp-socket"],"latest_commit_sha":null,"homepage":null,"language":"C++","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/youngmonkeys.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,"zenodo":null}},"created_at":"2017-11-29T03:36:27.000Z","updated_at":"2024-01-25T13:36:09.000Z","dependencies_parsed_at":"2024-11-11T22:36:45.562Z","dependency_job_id":"615939af-6f85-4975-8a47-a47f31a30e3c","html_url":"https://github.com/youngmonkeys/ezyfox-server-cpp-client","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/youngmonkeys/ezyfox-server-cpp-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youngmonkeys%2Fezyfox-server-cpp-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youngmonkeys%2Fezyfox-server-cpp-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youngmonkeys%2Fezyfox-server-cpp-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youngmonkeys%2Fezyfox-server-cpp-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/youngmonkeys","download_url":"https://codeload.github.com/youngmonkeys/ezyfox-server-cpp-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youngmonkeys%2Fezyfox-server-cpp-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266780378,"owners_count":23983041,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["c","cpp","cpp-sockets","socket-client","tcp-socket"],"created_at":"2024-11-11T22:36:37.660Z","updated_at":"2025-07-24T01:39:04.829Z","avatar_url":"https://github.com/youngmonkeys.png","language":"C++","readme":"# ezyfox-server-cpp-client \u003cimg src=\"https://github.com/youngmonkeys/ezyfox-server/blob/master/logo.png\" width=\"64\" /\u003e\nc++ client for ezyfox server\n\n# Official Documentation\n\n[https://youngmonkeys.org/ezyfox-cpp-client-sdk/](https://youngmonkeys.org/ezyfox-cpp-client-sdk/)\n\n# Code Example\n\nFor full example you can find out at [space game](https://github.com/tvd12/space-game)\n\n**1. Import**\n\n```cpp\n#include \"EzyHeaders.h\"\n```\n\n```cpp\nusing namespace EZY_NAMESPACE;\n```\n\n**2. Create a TCP Client**\n\n```cpp\nauto config = config::EzyClientConfig::create();\nconfig-\u003esetClientName(\"first\");\nconfig-\u003esetZoneName(\"example\");\nauto client = EzyClients::getInstance()-\u003enewDefaultClient(config);\n```\n\n**3. Setup client**\n\n```cpp\nauto setup = client-\u003esetup();\nsetup-\u003eaddEventHandler(event::ConnectionSuccess, new handler::EzyConnectionSuccessHandler());\nsetup-\u003eaddEventHandler(event::ConnectionFailure, new handler::EzyConnectionFailureHandler());\nsetup-\u003eaddDataHandler(constant::Handshake, new ExHandshakeHandler());\nsetup-\u003eaddDataHandler(constant::Login, new ExLoginSuccessHandler());\nsetup-\u003eaddDataHandler(constant::AppAccess, new ExAppAccessHandler());\n```\n\n**4. Setup app**\n\n```cpp\nauto appSetup = setup-\u003esetupApp(\"hello-world\");\nappSetup-\u003eaddDataHandler(\"broadcastMessage\", new MessageResponseHandler());\n```\n\n**5. Connect to server**\n\n```cpp\nclient-\u003econnect(\"localhost\", 3005);\n```\n\n**6. Handle socket's events on main thread**\n\n```cpp\nauto mainEventsLoop = new socket::EzyMainEventsLoop();\nmainEventsLoop-\u003estart();\n```\n\n**7. Custom event handler**\n\n```cpp\nclass ExHandshakeHandler : public handler::EzyHandshakeHandler {\nprotected:\n    request::EzyRequest* getLoginRequest() {\n        auto request = request::EzyLoginRequest::create();\n        request-\u003esetZoneName(\"example\");\n        request-\u003esetUsername(\"yourname\");\n        request-\u003esetPassword(\"123456\");\n        return request;\n    };\n};\n\nclass ExLoginSuccessHandler : public handler::EzyLoginSuccessHandler {\nprotected:\n    void handleLoginSuccess(entity::EzyArray* joinedApps, entity::EzyValue* responseData) {\n        auto request = request::EzyAppAccessRequest::create();\n        request-\u003esetAppName(\"hello-world\");\n        request-\u003esetData(new entity::EzyArray());\n        mClient-\u003esend(request);\n    }\n};\n\nclass ExAppAccessHandler : public handler::EzyAppAccessHandler {\nprotected:\n    void postHandle(entity::EzyApp* app, entity::EzyArray* data) {\n        auto obj = new entity::EzyObject();\n        obj-\u003esetString(\"message\", \"Hi EzyFox, I'm from C++ client\");\n        app-\u003esend(\"broadcastMessage\", obj);\n    }\n};\n```\n**8. Custom app's data handler**\n\n```cpp\nclass MessageResponseHandler : public handler::EzyAbstractAppDataHandler\u003centity::EzyValue\u003e {\nprotected:\n    void process(entity::EzyApp* app, entity::EzyValue* data) {\n        logger::log(\"recived message: \");\n#ifdef EZY_DEBUG\n        data-\u003eprintDebug();\n#endif\n    }\n};\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoungmonkeys%2Fezyfox-server-cpp-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyoungmonkeys%2Fezyfox-server-cpp-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoungmonkeys%2Fezyfox-server-cpp-client/lists"}