{"id":44447763,"url":"https://github.com/lexzaiello/go-simplesub","last_synced_at":"2026-02-12T16:00:38.752Z","repository":{"id":112455712,"uuid":"188873478","full_name":"lexzaiello/go-simplesub","owner":"lexzaiello","description":"A minimalistic pubsub messaging system built on top of libp2p with routing support.","archived":false,"fork":false,"pushed_at":"2022-12-08T21:49:55.000Z","size":100,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-14T21:06:11.687Z","etag":null,"topics":["go","go-libp2p","libp2p","messaging","networking","pub-sub","pubsub","simplesub"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lexzaiello.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":"2019-05-27T16:04:52.000Z","updated_at":"2023-01-05T07:53:40.000Z","dependencies_parsed_at":"2023-05-15T04:30:21.724Z","dependency_job_id":null,"html_url":"https://github.com/lexzaiello/go-simplesub","commit_stats":null,"previous_names":["lexzaiello/go-simplesub","dowlandaiello/go-simplesub"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lexzaiello/go-simplesub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexzaiello%2Fgo-simplesub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexzaiello%2Fgo-simplesub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexzaiello%2Fgo-simplesub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexzaiello%2Fgo-simplesub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lexzaiello","download_url":"https://codeload.github.com/lexzaiello/go-simplesub/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexzaiello%2Fgo-simplesub/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29371383,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"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":["go","go-libp2p","libp2p","messaging","networking","pub-sub","pubsub","simplesub"],"created_at":"2026-02-12T16:00:23.855Z","updated_at":"2026-02-12T16:00:38.740Z","avatar_url":"https://github.com/lexzaiello.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-simplesub\n\nA minimalistic, yet powerful pubsub messaging system built on top of libp2p.\n\n## Rationale\n\n```English\nWhy does this repo exist?\n```\n\nSimple: Libp2p's pub/sub implementation simply does not provide enough flexibility\nfor some use cases (those that utilize a DHT or any sort of routing in particular).\n\n## Installation\n\n```zsh\ngo get github.com/dowlandaiello/go-simplesub\n```\n\n## Usage\n\n```Go\npackage main\n\nimport (\n    \"context\"\n\n    \"github.com/libp2p/go-libp2p\"\n    dht \"github.com/libp2p/go-libp2p-kad-dht\"\n    routed \"github.com/libp2p/go-libp2p/p2p/host/routed\"\n    \"github.com/dowlandaiello/go-simplesub\"\n    inet \"github.com/libp2p/go-libp2p-net\"\n)\n\nfunc main() {\n    ctx, cancel := context.WithCancel(context.Background()) // Initialize context\n\n    defer cancel() // Cancel\n\n    host, err := libp2p.New(\n        ctx,\n        libp2p.NATPortMap(),\n        libp2p.ListenAddrStrings(\n            \"/ip4/0.0.0.0/tcp/1111\",\n            \"/ip6/::1/tcp/1111\",\n        ),\n    ) // Initialize host\n\n    if err != nil { // Check for errors\n        panic(err) // Panic\n    }\n\n    dht, err := dht.New(ctx, host) // Initialize dht\n\n    if err != nil { // Check for errors\n        panic(err) // Panic\n    }\n\n    routedHost := routed.Wrap(host, dht) // Wrap host\n\n    sub, err := simplesub.NewSimpleSub(routedHost) // Initialize sub\n\n    if err != nil { // Check for errors\n        panic(err) // Panic\n    }\n\n    sub.Subscribe(\"test_topic\", handler) // Subscribe\n\n    err = sub.Publish(ctx, \"test_topic\", []byte(\"test\")) // Publish to topic\n\n    if err != nil { // Check for errors\n        panic(err) // Panic\n    }\n}\n\n// handler handles a new incoming stream.\nfunc handler(stream inet.Stream, message *simplesub.Message) {\n    fmt.Printf(\"Received message: %s\", string(message.Data)) // Log received\n}\n```\n\n## Configuration\n\n### Route Prefixes\n\nBy default, all simplesub routes are registered under `/`.\nShould one wish to add a prefix to such a route, simply pass the `WithRoutePrefix` option function\nto the simplesub constructor.\n\nExample:\n\n```Go\nsub, err := simplesub.NewSimpleSub(routedHost, simplesub.WithRoutePrefix(\"test_net\")) // Initialize sub\n\nif err != nil { // Check for errors\n    panic(err) // Panic\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flexzaiello%2Fgo-simplesub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flexzaiello%2Fgo-simplesub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flexzaiello%2Fgo-simplesub/lists"}