{"id":13417985,"url":"https://github.com/socketio/socket.io-client-cpp","last_synced_at":"2025-05-14T21:06:27.315Z","repository":{"id":29546950,"uuid":"33086039","full_name":"socketio/socket.io-client-cpp","owner":"socketio","description":"C++11 implementation of Socket.IO client","archived":false,"fork":false,"pushed_at":"2024-08-16T07:13:22.000Z","size":1041,"stargazers_count":2308,"open_issues_count":166,"forks_count":737,"subscribers_count":113,"default_branch":"master","last_synced_at":"2025-04-10T05:02:36.418Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","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/socketio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2015-03-29T19:31:21.000Z","updated_at":"2025-04-09T03:05:37.000Z","dependencies_parsed_at":"2023-11-08T23:31:40.852Z","dependency_job_id":"c9ecbf55-5cf7-4901-a4c7-00d899052c07","html_url":"https://github.com/socketio/socket.io-client-cpp","commit_stats":{"total_commits":218,"total_committers":48,"mean_commits":4.541666666666667,"dds":0.3853211009174312,"last_synced_commit":"da779141a7379cc30c870d48295033bc16a23c66"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketio%2Fsocket.io-client-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketio%2Fsocket.io-client-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketio%2Fsocket.io-client-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketio%2Fsocket.io-client-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/socketio","download_url":"https://codeload.github.com/socketio/socket.io-client-cpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254227611,"owners_count":22035669,"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":[],"created_at":"2024-07-30T22:00:56.692Z","updated_at":"2025-05-14T21:06:22.293Z","avatar_url":"https://github.com/socketio.png","language":"C++","readme":"# Socket.IO C++ Client\n\n[![Build Status](https://github.com/socketio/socket.io-client-cpp/workflows/CI/badge.svg)](https://github.com/socketio/socket.io-client-cpp/actions)\n\nBy virtue of being written in C++, this client works in several different platforms. The [examples](https://github.com/socketio/socket.io-client-cpp/tree/master/examples) folder contains an iPhone, QT and Console example chat client! It depends on [websocket++](https://github.com/zaphoyd/websocketpp) and is inspired by [socket.io-clientpp](https://github.com/ebshimizu/socket.io-clientpp).\n\n[![Clients with iPhone, QT, Console and web](https://cldup.com/ukvVVZmvYV.png)](https://github.com/socketio/socket.io-client-cpp/tree/master/examples)\n\n## Compatibility table\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth rowspan=\"2\"\u003eC++ Client version\u003c/th\u003e\n    \u003cth colspan=\"2\"\u003eSocket.IO server version\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e1.x / 2.x\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e3.x / 4.x\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e2.x (\u003ccode\u003e2.x\u003c/code\u003e branch)\u003c/td\u003e\n    \u003ctd align=\"center\"\u003eYES\u003c/td\u003e\n    \u003ctd align=\"center\"\u003eYES, with \u003ccode\u003e\u003ca href=\"https://socket.io/docs/v4/server-initialization/#allowEIO3\"\u003eallowEIO3: true\u003c/a\u003e\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e3.x (\u003ccode\u003emaster\u003c/code\u003e branch)\u003c/td\u003e\n    \u003ctd align=\"center\"\u003eNO\u003c/td\u003e\n    \u003ctd align=\"center\"\u003eYES\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n## Features\n\n- 100% written in modern C++11\n- Binary support\n- Automatic JSON encoding\n- Multiplex support\n- Similar API to the Socket.IO JS client\n- Cross platform\n\nNote: Only the WebSocket transport is currently implemented (no fallback to HTTP long-polling)\n\n## Installation alternatives\n\n* [With CMAKE](./INSTALL.md#with-cmake)\n* [Without CMAKE](./INSTALL.md#without-cmake)\n* [With VCPKG](./INSTALL.md#with-vcpkg)\n* [With Conan](./INSTALL.md#with-conan)\n* [iOS and OS X](./INSTALL_IOS.md)\n * Option 1: Cocoapods\n * Option 2: Create a static library\n * Option 3: Manual integration\n\n\n## Quickstart\n\n** [Full overview of API can be seen here](./API.md) **\n\n\nThe APIs are similar to the JS client.\n\n#### Connect to a server\n```C++\nsio::client h;\nh.connect(\"http://127.0.0.1:3000\");\n```\n\n#### Emit an event\n\n```C++\n// emit event name only:\nh.socket()-\u003eemit(\"login\");\n\n// emit text\nh.socket()-\u003eemit(\"add user\", username);\n\n// emit binary\nchar buf[100];\nh.socket()-\u003eemit(\"add user\", std::make_shared\u003cstd::string\u003e(buf,100));\n\n// emit message object with lambda ack handler\nh.socket()-\u003eemit(\"add user\", string_message::create(username), [\u0026](message::list const\u0026 msg) {\n});\n\n// emit multiple arguments\nmessage::list li(\"sports\");\nli.push(string_message::create(\"economics\"));\nsocket-\u003eemit(\"categories\", li);\n```\nItems in `message::list` will be expanded in server side event callback function as function arguments.\n\n#### Bind an event\n\n##### Bind with function pointer\n```C++\nvoid OnMessage(sio::event \u0026)\n{\n\n}\nh.socket()-\u003eon(\"new message\", \u0026OnMessage);\n```\n\n##### Bind with lambda\n```C++\nh.socket()-\u003eon(\"login\", [\u0026](sio::event\u0026 ev)\n{\n    //handle login message\n    //post to UI thread if any UI updating.\n});\n```\n\n##### Bind with member function\n```C++\nclass MessageHandler\n{\npublic:\n    void OnMessage(sio::event \u0026);\n};\nMessageHandler mh;\nh.socket()-\u003eon(\"new message\",std::bind( \u0026MessageHandler::OnMessage,\u0026mh,std::placeholders::_1));\n```\n\n#### Using namespace\n```C++\nh.socket(\"/chat\")-\u003eemit(\"add user\", username);\n```\n** [Full overview of API can be seen here](./API.md) **\n\n## License\n\nMIT\n","funding_links":[],"categories":["TODO scan for Android support in followings","C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketio%2Fsocket.io-client-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsocketio%2Fsocket.io-client-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketio%2Fsocket.io-client-cpp/lists"}