{"id":21664693,"url":"https://github.com/swift-libp2p/swift-libp2p-pubsub","last_synced_at":"2026-05-16T20:36:23.173Z","repository":{"id":186187258,"uuid":"506296340","full_name":"swift-libp2p/swift-libp2p-pubsub","owner":"swift-libp2p","description":"A Publish-Subscribe library for peer to peer messaging within libp2p","archived":false,"fork":false,"pushed_at":"2026-01-12T20:34:47.000Z","size":347,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-13T00:45:50.482Z","etag":null,"topics":["floodsub","gossipsub","libp2p","libp2p-pubsub","networking","p2p","pubsub","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/swift-libp2p.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-06-22T15:06:15.000Z","updated_at":"2026-01-12T20:34:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"d072e419-66e1-49d3-9b46-27dfef4b4495","html_url":"https://github.com/swift-libp2p/swift-libp2p-pubsub","commit_stats":null,"previous_names":["swift-libp2p/swift-libp2p-pubsub"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/swift-libp2p/swift-libp2p-pubsub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swift-libp2p%2Fswift-libp2p-pubsub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swift-libp2p%2Fswift-libp2p-pubsub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swift-libp2p%2Fswift-libp2p-pubsub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swift-libp2p%2Fswift-libp2p-pubsub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swift-libp2p","download_url":"https://codeload.github.com/swift-libp2p/swift-libp2p-pubsub/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swift-libp2p%2Fswift-libp2p-pubsub/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33118092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T18:38:32.183Z","status":"ssl_error","status_checked_at":"2026-05-16T18:38:29.903Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["floodsub","gossipsub","libp2p","libp2p-pubsub","networking","p2p","pubsub","swift"],"created_at":"2024-11-25T10:41:58.116Z","updated_at":"2026-05-16T20:36:23.167Z","avatar_url":"https://github.com/swift-libp2p.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LibP2PPubSub\n\n[![](https://img.shields.io/badge/made%20by-Breth-blue.svg?style=flat-square)](https://breth.app)\n[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)\n[![Swift Package Manager compatible](https://img.shields.io/badge/SPM-compatible-blue.svg?style=flat-square)](https://github.com/apple/swift-package-manager)\n![Build \u0026 Test (macos and linux)](https://github.com/swift-libp2p/swift-libp2p-pubsub/actions/workflows/build+test.yml/badge.svg)\n\n\u003e A WIP implementation of FloodSub and GossipSub Routers for swift-libp2p\n\n\u003e **Warning**\n\u003e This is a WIP. It probably won't work the way it's supposed to. Please file issues accordingly.\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Install](#install)\n- [Usage](#usage)\n  - [Example](#example)\n  - [API](#api)\n- [Contributing](#contributing)\n- [Credits](#credits)\n- [License](#license)\n\n## Overview\nThis repo contains the pubsub implementation for swift-libp2p. We currently provide two message routers:\n\n- Floodsub, which is the baseline flooding protocol.\n- Gossipsub, which is a more advanced router with mesh formation and gossip propagation.\n\n\u003e **Note**\n\u003e For more information check out the [Libp2p PubSub Spec](https://github.com/libp2p/specs/tree/master/pubsub) \n\n## Install\n\nInclude the following dependency in your Package.swift file\n```Swift\nlet package = Package(\n    ...\n    dependencies: [\n        ...\n        .package(name: \"LibP2PPubSub\", url: \"https://github.com/swift-libp2p/swift-libp2p-pubsub.git\", .upToNextMinor(from: \"0.2.0\"))\n    ],\n    \n    ...\n)\n```\n\n## Usage\n\n### Example \ncheck out the [tests]() for more examples\n\n```Swift\n\nimport LibP2PPubSub\n\n/// Configure libp2p\nlet app = Application(...)\n// We have to use the `BasicConnectionLight` `Connection` implementation here! (the default `ARCConnection`, doesn't work due to the agressive timeout behaviour...)\napp.connectionManager.use(connectionType: BasicConnectionLight.self)\n// Tell it to use Floodsub\napp.pubsub.use(.floodsub)\n// Or tell it to use Gossipsub\napp.pubsub.use(.gossipsub)\n\n/// Subscribe\nlet subscription = try app.pubsub.gossipsub.subscribe(.init(topic: \"news\", signaturePolicy: .strictSign, validator: .acceptAll, messageIDFunc: .hashSequenceNumberAndFromFields))\nsubscription.on = { event -\u003e EventLoopFuture\u003cVoid\u003e in\n    switch event {\n    case .newPeer(let peer):\n        ...\n        \n    case .data(let pubSubMessage):\n        ...\n        \n    case .error(let error):\n        ...\n    }\n    return app.eventLoopGroup.any().makeSucceededVoidFuture()\n}\n\n\n/// Publish Message\n// Using a subscription\nsubscription.publish(\"Hello\".data(using: .utf8))\n// Without a subscription\napp.pubsub.publish(\"Hello\".data(using: .utf8), to: \"topic\")\n\n\n/// Unsubscribe\n// Using a subscription\nsubscription.unsubscribe()\n// Without a subscription\napp.pubsub.unsubscribe(\"topic\")\n\n\n/// Stop the app\napp.shutdown()\n\n```\n\n### API\n```Swift\n/// Initializers\n\n/// Properties\n\n/// Methods\n\n```\n\n## Contributing\n\nContributions are welcomed! This code is very much a proof of concept. I can guarantee you there's a better / safer way to accomplish the same results. Any suggestions, improvements, or even just critiques, are welcome! \n\nLet's make this code better together! 🤝\n\n## Credits\n\n- [PubSub Spec](https://github.com/libp2p/specs/tree/master/pubsub) \n- [The JS PubSub implementation](https://github.com/libp2p/js-libp2p-interfaces) \n- [The GO PubSub implementation](https://github.com/libp2p/go-libp2p-pubsub)\n\n## License\n\n[MIT](LICENSE) © 2022 Breth Inc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswift-libp2p%2Fswift-libp2p-pubsub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswift-libp2p%2Fswift-libp2p-pubsub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswift-libp2p%2Fswift-libp2p-pubsub/lists"}