{"id":24897295,"url":"https://github.com/falk-werner/liboizys","last_synced_at":"2025-06-14T06:38:30.315Z","repository":{"id":236572719,"uuid":"792880754","full_name":"falk-werner/liboizys","owner":"falk-werner","description":"IPC libary based on boost asio","archived":false,"fork":false,"pushed_at":"2024-05-05T11:28:04.000Z","size":88,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T20:17:17.320Z","etag":null,"topics":["asio","async","boost","ipc","websocket"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/falk-werner.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}},"created_at":"2024-04-27T20:13:19.000Z","updated_at":"2024-05-05T11:28:08.000Z","dependencies_parsed_at":"2024-04-29T21:32:46.213Z","dependency_job_id":null,"html_url":"https://github.com/falk-werner/liboizys","commit_stats":null,"previous_names":["falk-werner/asio-example","falk-werner/liboizys"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/falk-werner%2Fliboizys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/falk-werner%2Fliboizys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/falk-werner%2Fliboizys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/falk-werner%2Fliboizys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/falk-werner","download_url":"https://codeload.github.com/falk-werner/liboizys/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245886419,"owners_count":20688661,"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":["asio","async","boost","ipc","websocket"],"created_at":"2025-02-01T20:17:19.167Z","updated_at":"2025-03-27T16:42:48.268Z","avatar_url":"https://github.com/falk-werner.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build](https://github.com/falk-werner/liboizys/actions/workflows/build.yaml/badge.svg)](https://github.com/falk-werner/liboizys/actions/workflows/build.yaml)\n\n# liboizys\n\nLiboizys is a interprocess communication library based on \n[boost asio](https://www.boost.org/doc/libs/1_85_0/doc/html/boost_asio.html).\nIt provides a simple to use [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API)-like API.\n\n**Note**:  \n*liboizys is optimized for usage in single thread environments. If you plan to use liboizys in a multithreaded environment, make sure that `send` is invoked from within the same thread that runs the assiciated `asio::io_context`.*\n\n## Concept\n\nThe core of liboizys is the [session](inc/oizys/session_i.hpp) interface:\n\n```C++\nclass session_i\n{\npublic:\n    virtual ~session_i() = default;\n    virtual void send(std::string const \u0026 message) = 0;\n    virtual void set_onclose(close_handler handler) = 0;\n    virtual void set_onmessage(message_handler handler) = 0;\n    virtual void close() = 0;\n};\n```\n\nAn instance of a session can be created using the `create_session` method:\n\n```C++\nboost::asio::io_context context;\nboost::asio::local::stream_protocol::socket sock(context);\n\n// ToDo: Connect socket\n\nauto session = oizys::create_session(std::move(sock));\n```\n\nThe API is resembles the widly used [WebSocket API](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API):\n- the `send` method is used to send messages to a connected peer\n- the `set_onmessage` method is used to register a handler that is called whenever a message is received\n- the `close` method is used to close the session\n- the `set_onclose` method is used to register a handler that is called when the session is closed\n\nWhenever an error occurs the session is closed.\n\n**Note:**  \n*The WebSocket API also specifies an `onerror` handler, which is not available in liboizys. Since each error leads to closing the session, this handler is omitted. The error code is instead provided to the close handler.*\n\n## Protocol\n\nLiboizys uses a simple binary protocol to transfer a series of messages between the\nconnected peers. Each message contains a 4 byte header and the actual content of the\nmessage.\n\n### Header\n\nThe header consists of a reserved byte and three bytes that encode the length of the message in [network byte order (big endian)](https://en.wikipedia.org/wiki/Endianness#Networking).\n\n### Message Content\n\nBinary content of the message.\n\n### Constaints\n\n- Messages without contents are prohibited and **must not** be transferred\n- The max. message size is 16MByte - 1 byte (16777215 bytes)\n\n### Examples\n\n```\nHi -\u003e 0x00 0x00 0x00 0x02 'H' 'i'\n\nfoo -\u003e 0x00 0x00 0x00 0x03 'f' 'o' 'o'\n```\n\n## Quirks\n\n- The library is optimized for usage in single threaded environment.  \n  When used in a multithreaded environment, make sure to call `send` only from\n  within the same thread that runs the `asio::io_context`.\n- A `message_handler` should always be set in order to detect a closed connection early.  \n  When a `message_handler` is set, the session is put into read mode. When the peer\n  closes the connection, a pending read will immediatly return and the close handler\n  is invoked.\n- All handlers are removed when the session is closed.  \n  Be prepared that all message handlers are removed when a session is closed. You\n  should no access any variable captured by a `close_handler` after `close` is\n  called.\n- Finish of `send` cannot be detected.  \n  The API does not allow to detect when a message is send nor when it is delivered\n  to the peer.\n\n## Build and Install\n\n```bash\ncmake -B build\ncmake --build build\nsudo cmake --install build\n```\n\n### CMake Options\n\n| Option | Default | Description |\n| ------ | ------- | ----------- |\n| WITHOUT_TEST | OFF | Disables unit tests |\n| WITHOUT_EXAMPLES | OFF | Disabled examples |\n\n### Coverage\n\nTo enable code coverage, use `CMAKE_BUILD_TYPE=Coverage`:\n\n```bash\ncmake -B build -DCMAKE_BUILD_TYPE=Coverage\n```\n\nAfterwards, coverage of unit tests can be created using `coverage-report` build target:\n\n```bash\ncmake --build build --target coverage-report\n```\n\n### Dependencies\n\n- [boost asio](https://www.boost.org/doc/libs/1_85_0/doc/html/boost_asio.html)\n- [clang-tidy](https://clang.llvm.org/extra/clang-tidy/)\n\nTest dependencies:\n\n- [googletest](https://github.com/google/googletest)\n\nCode coverage dependencies:\n\n- [gcov](https://gcc.gnu.org/onlinedocs/gcc/Gcov.html)\n- [lcov](https://github.com/linux-test-project/lcov)\n\nExamples dependencies:\n\n- [protobuf](https://protobuf.dev/)\n\n## References\n\n- [boost asio](https://www.boost.org/doc/libs/1_85_0/doc/html/boost_asio.html)\n- [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API)\n- [protobuf](https://protobuf.dev/)\n- [clang-tidy](https://clang.llvm.org/extra/clang-tidy/)\n- [googletest](https://github.com/google/googletest)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffalk-werner%2Fliboizys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffalk-werner%2Fliboizys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffalk-werner%2Fliboizys/lists"}