{"id":28396282,"url":"https://github.com/ssbc/ssb-gossip","last_synced_at":"2025-07-06T12:34:04.177Z","repository":{"id":45884303,"uuid":"164179443","full_name":"ssbc/ssb-gossip","owner":"ssbc","description":"Schedule connections randomly with a peerlist constructed from config, multicast UDP announcements, feed announcements, and API-calls","archived":false,"fork":false,"pushed_at":"2021-11-29T23:44:54.000Z","size":75,"stargazers_count":10,"open_issues_count":4,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-08T20:59:16.041Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ssbc.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":"2019-01-05T03:48:36.000Z","updated_at":"2021-11-29T23:44:57.000Z","dependencies_parsed_at":"2022-09-10T17:01:44.079Z","dependency_job_id":null,"html_url":"https://github.com/ssbc/ssb-gossip","commit_stats":null,"previous_names":["dominictarr/ssb-gossip"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/ssbc/ssb-gossip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fssb-gossip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fssb-gossip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fssb-gossip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fssb-gossip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ssbc","download_url":"https://codeload.github.com/ssbc/ssb-gossip/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fssb-gossip/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260085545,"owners_count":22956613,"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":[],"created_at":"2025-05-31T21:37:49.285Z","updated_at":"2025-07-06T12:34:04.171Z","avatar_url":"https://github.com/ssbc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ssb-gossip\n\nssb-server gossip plugin\n\n⚠️  See also: [ssb-conn](https://github.com/staltz/ssb-conn)\n\nto have a peer to peer network, a ssb instance needs to have some other peers to connect with.\nThis module keeps track of those peers. There are a number of ways a you can know about a peer,\n\n* observed a local udp broadcast from them [ssb-server/plugins/local](https://github.com/ssbc/ssb-server/blob/master/plugins/local.js)\n* received their device-address message [ssb-device-address](https://github.com/ssbc/ssb-device-address)\n* received a pub message about them [ssb-gossip/init](https://github.com/ssbc/ssb-gossip/blob/master/init.js#L14-L29)\n* configured their address manually as a [seed](https://github.com/ssbc/ssb-gossip/blob/master/init.js#L11-L12)\n* or the user called [gossip.add](#add-sync)\n\nNotice these are mostly managed by other plugins.\n\nThe gossip plugin then decides when to connect to those peers, which it does mostly randomly.\n(connecting randomly means you will _eventually_ connect to everyone, thus a useful database property: [eventual consistency](https://en.wikipedia.org/wiki/Eventual_consistency)) \n\n## peers: sync\n\nGet the current known peers.\n\n```bash\npeers\n```\n\n```js\npeers(cb)\n```\n\n## add: sync\n\nAdd a peer.\n\n```bash\n#add a multiserver address.\nadd {addr}\n#legacy format\nadd --host {string} --port {number} --key {feedid}\n```\n\n```js\nadd(addr, cb)\nadd({ host:, port:, key: }, cb)\n```\n\n - `addr` (address string): A [multiserver address](https://github.com/ssbc/multiserver#address-format)\n - `host` (host string): IP address or hostname.\n - `port` (port number)\n - `key` (feedid)\n\n## remove: sync\n\nRemove an address from the peer table.\n\n```bash\nremove {addr}\nremove --host {string} --port {number} --key {feedid}\n```\n\n```js\nremove(addr)\nremove({ host:, port:, key: })\n```\n\n## ping: duplex\n\nused internally by the gossip plugin to measure latency and clock skew\n\n## connect: async\n\nAdd an address to the peer table, and connect immediately.\n\n```bash\nconnect {addr}\nconnect --host {string} --port {number} --key {feedid}\n```\n\n```js\nconnect(addr, cb)\nconnect({ host:, port:, key: }, cb)\n```\n\n - `addr` (address string): An address string, of the following format: `hostname:port:feedid`.\n - `host` (host string): IP address or hostname.\n - `port` (port number)\n - `key` (feedid)\n\n\n## changes: source\n\nListen for gossip events.\n\n```bash\nchanges\n```\n\n```js\nchanges()\n```\n\nEvents come in the following forms:\n\n```\n{ type: 'discover', peer:, source: }\n{ type: 'connect', peer: }\n{ type: 'connect-failure', peer: }\n{ type: 'disconnect', peer: }\n```\n\n## reconnect: sync\n\nTell ssb-server to reinitiate gossip connections now.\n\n\n## enable: sync\n\nUpdate the config to enable a gossip type.\n\n```bash\nenable {type}\n```\n```js\nenable(type, cb)\n```\n\n - type (string): The type of gossip to enable: local, global, or seed. Default\n     global.\n\n\n## disable: sync\n\nUpdate the config to disable a gossip type.\n\n```bash\ndisable {type}\n```\n```js\ndisable(type, cb)\n```\n\n - type (string): The type of gossip to enable: local, global, or seed. Default\n     global.\n\n## License\n\nMIT\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssbc%2Fssb-gossip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fssbc%2Fssb-gossip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssbc%2Fssb-gossip/lists"}