{"id":17962395,"url":"https://github.com/grafov/bcast","last_synced_at":"2025-03-25T04:31:58.727Z","repository":{"id":10379940,"uuid":"12526467","full_name":"grafov/bcast","owner":"grafov","description":"Broadcasting library for Go. Broadcast message of any type on a set of channels. WIP","archived":false,"fork":false,"pushed_at":"2019-02-17T19:03:53.000Z","size":48,"stargazers_count":100,"open_issues_count":6,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-06-18T15:39:39.536Z","etag":null,"topics":["broadcast-messages","broadcasting","library"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grafov.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}},"created_at":"2013-09-01T20:37:24.000Z","updated_at":"2024-06-15T18:00:23.000Z","dependencies_parsed_at":"2022-08-31T13:11:07.893Z","dependency_job_id":null,"html_url":"https://github.com/grafov/bcast","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafov%2Fbcast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafov%2Fbcast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafov%2Fbcast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafov%2Fbcast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grafov","download_url":"https://codeload.github.com/grafov/bcast/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222035692,"owners_count":16919925,"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":["broadcast-messages","broadcasting","library"],"created_at":"2024-10-29T11:19:17.351Z","updated_at":"2024-10-29T11:19:18.704Z","avatar_url":"https://github.com/grafov.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"bcast package for Go\n====================\n\nBroadcasting on a set of channels in Go. Go channels offer different usage patterns but not ready to use broadcast pattern.\nThis library solves the problem in direct way. Each routine keeps member structure with own input channel and single for all\nmembers output channel. Central dispatcher accepts broadcasts and resend them to all members.\n\nUsage [![Go Walker](http://img.shields.io/badge/docs-API-brightgreen.svg?style=flat)](http://gowalker.org/github.com/NimbleIndustry/bcast)\n-----\n\nFirstly import package and create broadcast group. You may create any number of groups for different broadcasts:\n\n\t\t\timport (\n\t\t\t\t\"github.com/grafov/bcast\"\n\t\t\t)\n\n\t\t\tgroup := bcast.NewGroup() // create broadcast group\n\t\t\tgo group.Broadcast(0) // accepts messages and broadcast it to all members\n\nYou may listen broadcasts limited time:\n\n\t\t\tbcast.Broadcast(2 * time.Minute) // if message not arrived during 2 min. function exits\n\nNow join to the group from different goroutines:\n\n\t\t\tmember1 := group.Join() // joined member1 from one routine\n\nEither member may send message which received by all other members of the group:\n\n\t\t\tmember1.Send(\"test message\") // send message to all members\n\nAlso you may send message to group from nonmember of a group:\n\n\t\t\tgroup.Send(\"test message\")\n\nMethod `Send` accepts `interface{}` type so any values may be broadcasted.\n\n\t\t\tmember2 := group.Join() // joined member2 form another routine\n\t\t\tval := member1.Recv() // broadcasted value received\n\nAnother way to receive broadcasted messages is listen input channel of the member.\n\n\t\t\tval := \u003c-*member1.In // each member keeps pointer to its own input channel\n\nIt may be convenient for example when `select` used.\n\nSee more examples in a test suit `bcast_test.go`.\n\nInstall\n-------\n\n`go get github.com/grafov/bcast`\n\nThe library doesn't require external packages for build. The next\npackage required if you want to run unit tests:\n\n`gopkg.in/fatih/set.v0`\n\nLicense\n-------\n\nLibrary licensed under BSD 3-clause license. See LICENSE.\n\nProject status [![Build Status](https://img.shields.io/travis/grafov/bcast/master.svg?style=flat)](https://travis-ci.org/grafov/bcast)\n--------------\n\nWIP again. There is bug found (see #12) and some possible improvements are waiting for review (#9).\n\nAPI is stable. No major changes planned, maybe small improvements.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafov%2Fbcast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrafov%2Fbcast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafov%2Fbcast/lists"}