{"id":13805399,"url":"https://github.com/nine-lives-later/zzmq","last_synced_at":"2025-04-11T20:10:54.216Z","repository":{"id":222975719,"uuid":"758866234","full_name":"nine-lives-later/zzmq","owner":"nine-lives-later","description":"Zig Binding for ZeroMQ","archived":false,"fork":false,"pushed_at":"2024-06-17T03:17:21.000Z","size":63,"stargazers_count":33,"open_issues_count":6,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T07:17:54.689Z","etag":null,"topics":["libzmq","zeromq","zeromq-czmq","zig","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/nine-lives-later.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":["fkollmann"],"custom":["https://paypal.me/flxk"]}},"created_at":"2024-02-17T10:06:10.000Z","updated_at":"2025-03-13T14:45:19.000Z","dependencies_parsed_at":"2024-08-04T01:15:04.983Z","dependency_job_id":null,"html_url":"https://github.com/nine-lives-later/zzmq","commit_stats":null,"previous_names":["nine-lives-later/zzmq"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nine-lives-later%2Fzzmq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nine-lives-later%2Fzzmq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nine-lives-later%2Fzzmq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nine-lives-later%2Fzzmq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nine-lives-later","download_url":"https://codeload.github.com/nine-lives-later/zzmq/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248473127,"owners_count":21109628,"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":["libzmq","zeromq","zeromq-czmq","zig","ziglang"],"created_at":"2024-08-04T01:01:00.776Z","updated_at":"2025-04-11T20:10:54.156Z","avatar_url":"https://github.com/nine-lives-later.png","language":"Zig","funding_links":["https://github.com/sponsors/fkollmann","https://paypal.me/flxk"],"categories":[],"sub_categories":[],"readme":"# Zig Binding for ZeroMQ\n\nThis Zig library provides a ZeroMQ client.\n\nIt is implemented based on the C API of [libzmq](https://libzmq.readthedocs.io/en/latest/).\nThe interface is highly inspired by [CZMQ](http://czmq.zeromq.org) and [goczmq](https://github.com/zeromq/goczmq).\n\nIt was originally based on the \"High-level C Binding for ZeroMQ\" ([CZMQ](http://czmq.zeromq.org)), \nbut later moved to using [libzmq](https://libzmq.readthedocs.io/en/latest/) directly, to provide zero-copy message support.\n\n\u003e [!IMPORTANT]\n\u003e The library is currently still work in progress!!\n\u003e \n\u003e Please feel free to open pull requests for features needed.\n\n[![Unit Tests](https://github.com/nine-lives-later/zzmq/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/nine-lives-later/zzmq/actions/workflows/test.yml) \n[![Examples](https://github.com/nine-lives-later/zzmq/actions/workflows/examples.yml/badge.svg?branch=main)](https://github.com/nine-lives-later/zzmq/actions/workflows/examples.yml)\n\n## Using the Library\n\n### Minimal Example\n\nThis repository holds various example within the `examples` folder.\nPlease feel free to also have a look at the various unit tests in this library (esp. [ZSocket](src/classes/zsocket.zig)).\n\nRunning the server (also see [full example](https://github.com/nine-lives-later/zzmq/tree/main/examples/hello_world_server)):\n\n```zig\nconst zzmq = @import(\"zzmq\");\n\nvar context = try zzmq.ZContext.init(allocator);\ndefer context.deinit();\n\nvar socket = try zzmq.ZSocket.init(zzmq.ZSocketType.Pair, \u0026context);\ndefer socket.deinit();\n\ntry socket.bind(\"tcp://127.0.0.1:*\");\n\nstd.log.info(\"Endpoint: {s}\", .{try socket.endpoint()});\n\n// send a message\nvar message = try zzmq.ZMessage.initUnmanaged(data, null);\ndefer message.deinit();\n\ntry socket.send(\u0026message, .{});\n```\n\nRunning the client (also see [full example](https://github.com/nine-lives-later/zzmq/tree/main/examples/hello_world_client)):\n\n```zig\nconst zzmq = @import(\"zzmq\");\n\nvar context = try zzmq.ZContext.init(allocator);\ndefer context.deinit();\n\nvar socket = try zzmq.ZSocket.init(zzmq.ZSocketType.Pair, \u0026context);\ndefer socket.deinit();\n\nconst endpoint = try std.fmt.allocPrint(allocator, \"tcp://127.0.0.1:{}\", .{port});\ndefer allocator.free(endpoint);\n\ntry socket.connect(endpoint);\n\n// receive a message\nvar message = try socket.receive(.{});\ndefer message.deinit();\n\nconst data = try message.data();\n```\n\n\n### Adding to build process\n\nDetermine the specific [release tag](https://github.com/nine-lives-later/zzmq/tags) of the library to use in the project.\n\n```sh\nzig fetch --save=zzmq 'https://github.com/nine-lives-later/zzmq/archive/refs/tags/v0.2.2-zig0.13.tar.gz'\n```\n\nIt is also required to add it to the `build.zig` file:\n\n```zig\nconst zzmq = b.dependency(\"zzmq\", .{\n    .target = target,\n    .optimize = optimize,\n});\n\nexe.root_module.addImport(\"zzmq\", zzmq.module(\"zzmq\"));\n\nexe.linkSystemLibrary(\"zmq\");\nexe.linkLibC();\n```\n\n### Installing local dependencies\n\nInstalling [libzmq](https://zeromq.org/download/) development library version 4.1 or higher is also required:\n\n```sh\n# Building on Ubuntu, PoP_OS, ZorinOS, etc.\nsudo apt install libzmq5-dev\n\n# Running on Ubuntu, PoP_OS, ZorinOS, etc.\nsudo apt install libzmq5\n```\n\nSee the [unit test Dockerfile](test.Dockerfile) on how to install it into an Alpine Docker image.\n\nTo retrieve the version of the libzmq library actually being used, call `ZContext.version()`.\n\n## Contributing\n\n### Zig Version Branches\n\nThere are branches for the supported Zig versions:\n\n| Branch     | Zig Version | Comment                                     |\n|------------|-------------|---------------------------------------------|\n| `main`     | Zig v0.13.x | The latest unreleased version for Zig 0.13. |\n| `zig-0.12` | Zig v0.12.x | The latest unreleased version for Zig 0.12. |\n| `zig-0.11` | Zig v0.11.x | The latest unreleased version for Zig 0.11. |\n\nPlease use a specific [release tag](https://github.com/nine-lives-later/zzmq/tags) for including the library into your project.\n\n### Testing\n\nThe library can be tested locally by running: `zig build test`.\n\n### Contributors\n\n- [Felix Kollmann](https://github.com/fkollmann)\n- [Jacob Green](https://github.com/7Zifle)\n- Inspired by [CZMQ](http://czmq.zeromq.org) and [goczmq](https://github.com/zeromq/goczmq).\n\n## License\n\nPublished under the [Mozilla Public License 2.0](https://www.mozilla.org/en-US/MPL/2.0/).\n\n- Static linking is allowed.\n- Safe for use in close-source applications.\n- You do not need a commercial license.\n\nFeel free to also see the [ZeroMQ licensing terms](https://zeromq.org/license/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnine-lives-later%2Fzzmq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnine-lives-later%2Fzzmq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnine-lives-later%2Fzzmq/lists"}