{"id":28396336,"url":"https://github.com/ssbc/ssb-netsim","last_synced_at":"2025-06-22T22:05:15.656Z","repository":{"id":57368790,"uuid":"392674798","full_name":"ssbc/ssb-netsim","owner":"ssbc","description":"a nodejs-based helper module for generating netsim statements","archived":false,"fork":false,"pushed_at":"2021-10-12T10:33:51.000Z","size":9,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-09T14:54:41.339Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"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":"LICENSES/CC0-1.0.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-04T12:10:02.000Z","updated_at":"2022-05-13T21:30:54.000Z","dependencies_parsed_at":"2022-08-23T20:10:23.349Z","dependency_job_id":null,"html_url":"https://github.com/ssbc/ssb-netsim","commit_stats":null,"previous_names":["ssb-ngi-pointer/ssb-netsim"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ssbc/ssb-netsim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fssb-netsim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fssb-netsim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fssb-netsim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fssb-netsim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ssbc","download_url":"https://codeload.github.com/ssbc/ssb-netsim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fssb-netsim/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260944211,"owners_count":23086759,"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:38:09.511Z","updated_at":"2025-06-22T22:05:15.640Z","avatar_url":"https://github.com/ssbc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\nSPDX-FileCopyrightText: 2021 Andre 'Staltz' Medeiros\n\nSPDX-License-Identifier: CC0-1.0\n--\u003e\n\n# ssb-netsim\nA [netsim](https://github.com/ssb-ngi-pointer/netsim/) helper library. \n\n`ssb-netsim` allows you to write javascript to generate netsim statements. For more info regarding netsim's statements, [read the docs](https://github.com/ssb-ngi-pointer/netsim/blob/main/commands.md).\n\n## Example\n```js\nvar netsim = require(\"./index.js\")\nvar sim = netsim()\nsim.comment(\"start the show\")\n\nvar peer = sim.peer(\"peer\", { hops: 1, caps: \"asasd\", skipoffsets: true, id: \"@asdasd.ed25519\" })\nvar bob = sim.peer(\"bob\", { hops: 1, caps: \"asasd\", skipoffsets: true, id: \"@2asdasd.ed25519\" })\npeer.start(\"ssb-server\")\nbob.start(\"go-ssb\")\nsim.wait(100)\npeer.follow(\"bob\")\npeer.has(\"bob\") // equivalent to peer.has(\"bob\", \"latest\")\npeer.has(\"bob\", 123)\npeer.connect(\"bob\")\npeer.disconnect(\"bob\")\npeer.waituntil(\"bob\", 1337)\npeer.waituntil(\"bob\") // equivalent to peer.waituntil(\"bob\", \"latest\")\npeer.post()\npeer.isfollowing(\"bob\")\npeer.isnotfollowing(\"bob\")\n\nvar a = { \"content\": \"is king\", \"nested\": { \"type\": \"cool\", \"extremely\": { \"deep\": \"key\" } }, \"ary\": [\"one\", \"two\", \"three\"] }\npeer.publish(a)\npeer.stop()\npeer.log() // equivalent to peer.log(1)\n```\n\n``` \ncomment start the show\nenter peer\nhops peer 1\ncaps peer asasd\nskipoffsets peer\nload peer @asdasd.ed25519\nenter bob\nhops bob 1\ncaps bob asasd\nskipoffsets bob\nload bob @2asdasd.ed25519\nstart peer ssb-server\nstart bob go-ssb\nwait 100\nfollow peer bob\nhas peer bob@latest\nhas peer bob@123\nconnect peer bob\ndisconnect peer bob\nwaituntil peer bob@1337\nwaituntil peer bob@latest\npost peer\nisfollowing peer bob\nisnotfollowing peer bob\npublish peer (content is king) (nested.type cool) (nested.extremely.deep key) (.ary one,two,three)\nstop peer\nlog peer 1\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssbc%2Fssb-netsim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fssbc%2Fssb-netsim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssbc%2Fssb-netsim/lists"}