{"id":15043749,"url":"https://github.com/spacebro/spacebro","last_synced_at":"2025-04-15T00:29:52.352Z","repository":{"id":3301125,"uuid":"48998768","full_name":"spacebro/spacebro","owner":"spacebro","description":"Spacebro makes communication between apps effortless","archived":false,"fork":false,"pushed_at":"2023-03-03T13:37:29.000Z","size":10216,"stargazers_count":14,"open_issues_count":23,"forks_count":5,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-04-14T22:21:11.511Z","etag":null,"topics":["realtime","socket-io","spacebro","websocket"],"latest_commit_sha":null,"homepage":"http://spacebro.space","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/spacebro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-01-04T13:29:51.000Z","updated_at":"2022-12-11T09:38:34.000Z","dependencies_parsed_at":"2023-02-18T15:02:19.402Z","dependency_job_id":null,"html_url":"https://github.com/spacebro/spacebro","commit_stats":{"total_commits":202,"total_committers":11,"mean_commits":"18.363636363636363","dds":0.7376237623762376,"last_synced_commit":"87a0a5149a65eb2dc5e7f48d5a5cb413a847eb02"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacebro%2Fspacebro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacebro%2Fspacebro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacebro%2Fspacebro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacebro%2Fspacebro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spacebro","download_url":"https://codeload.github.com/spacebro/spacebro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248983685,"owners_count":21193621,"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":["realtime","socket-io","spacebro","websocket"],"created_at":"2024-09-24T20:49:32.809Z","updated_at":"2025-04-15T00:29:52.335Z","avatar_url":"https://github.com/spacebro.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Spacebro 💫\n\n\u003e In reference to [Spacebrew](http://docs.spacebrew.cc/) by Rockwell Lab (http://www.rockwellgroup.com/search/LAB)\n\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\n[![node](https://img.shields.io/badge/node-4.0.x-brightgreen.svg)](https://nodejs.org/en/)\n[![node](https://img.shields.io/badge/node-5.3.x-brightgreen.svg)](https://nodejs.org/en/)\n[![node](https://img.shields.io/badge/node-6.x.x-brightgreen.svg)](https://nodejs.org/en/)\n\n*Spacebro* automagically links apps between them. It binds them with `events`. You just start a spacebro server somewhere, connect your spacebro clients and listen to events`.\n\n## Prerequisites\n\nSpacebro uses:\n\n* [socket.io](http://socket.io) to broadcast events.\n\n## Usage\n\n### As a CLI tool\n\nInstall it globally\n\n```bash\n$ npm i -g spacebro\n# or\n$ yarn global add spacebro\n```\n\nAnd just run the `bin` :\n\n```bash\n$ spacebro\n```\n\nYou can configure it via CLI args:\n\n```bash\n$ spacebro --server.port 8888\n# to view all possible arguments\n$ spacebro --help\n```\n\n\u003e NOTE: Spacebro uses\n\u003e [standard-settings](https://github.com/soixantecircuits/standard-settings/), see the doc there to change settings via argv, env or file\n\n### As a module\n\n```bash\n$ npm i --save spacebro\n# or\n$ yarn add spacebro\n```\n\nAnd then connection with a `spacebro-client` as is. The spacebro client allows to connect your node application to spacebro server, just by requiring it.\n\nSee [spacebro-client](https://github.com/soixantecircuits/spacebro-client) to learn more.\n\nFor openFramework you can also use [ofxSpaceBro](https://github.com/soixantecircuits/ofxSpacebroClient).\n\nFor python you can also use [pySpacebroClient](https://github.com/spacebro/pySpacebroClient).\n\n## Options\n\n|flag|what it does|\n|:---|:---|\n|`-h, --help`|output usage information|\n|`-V, --version`|output the version number|\n|`-P, --server.port \u003cn\u003e`|give a port to spacebro|\n|`-M, --mute`|option to hide informations|\n|`--semiverbose`|do not show events datas in logs|\n|`-H, --hidedashboard`|Allow to hide dashboard|\n\n## API\n\nOnce connected, you can interact with spacebro, to know which other\nclient is connected, what are the connections between them, add your own\nconnections, ...\n\nA `connection` is a link between an output of a client and an input of\nan other client. It is explained in details below.\n\n#### `register`\n\nMandatory event for a client to send to spacebro, this is implemented\ninside `spacebro-client` so you should not have to use this, unless you\nare writing a client plugin in an other language.\n\nThe data sent with the `register` event should include the keys below:\n\n```\n{\n  channelName: 'media-stream', // the socket.io channel to connect to\n  client: {\n    name: 'myclientname',\n    description: 'Describe here what your client does',\n    in: {// input events your client will react to\n      inMedia: {\n        eventName: \"inMedia\",\n        description: \"Describe the input event here\",\n        type: \"all\" // use all by default, or mention a type of data\nexpected\n      },\n      otherInput: {\n        ...\n      }\n    },\n    out: { // output events your client will send\n      outMedia: {\n        eventName: \"outMedia\",\n        description: \"Describe the input event here\",\n        type: \"all\" // use all by default, or mention a type of data\n      }\n    }\n  }\n}\n```\n\n#### `addConnections`\n\nAdd a connection between an output of a client and the input of an other\nclient.\n\nThe data can be a connection or an array of connections with a\nconnection respecting this schema\n\n```\n{\n  src: {\n    clientName: 'myclient',\n    eventName: 'outMedia'\n  },\n  tgt: {\n    clientName: 'myotherclient',\n    eventName: 'inMedia'\n  }\n}\n```\n\nor a string or array of strings with this syntax:\n\n```\nmyclient/outMedia =\u003e myotheclient/inMedia\n```\n\nWhen `myclient` emits a `outMedia` event, it will be forwarded to\n`myotherclient` with the event name `inMedia`\n\nA `connection` event is emitted to all clients with the updated\n\n#### `removeConnections`\n\nRemoves all connections listed in the data of this event: an array or\nsingle connection, in the schema seen above.  \nA `connection` event is emitted to all clients with the updated\nconnections list\n\n#### `replaceConnections`\n\nRemoves all connections on the current channel, and add the connections\nlisted in the data of this event.  \nA `connection` event is emitted to all clients with the updated\nconnections list\n\n#### `getConnections`\n\nAsk for a `connection` event, which is emitted to all clients with the\ncurrent connection list on the current channel.\n\n#### `getClients`\n\nAsk for a `clients` event, which is emitted to all clients with the\ncurrent client list on the current channel.\n\n#### `saveGraph`\n\nSave the current state: list of clients and list of connections, into\nthe settings file mentioned when running spacebro  \n\nFor example, run \n\n```\nspacebro --settings /path/to/my-settings-file.json\n```\n\nConnect some clients, add some connections, send a `saveGraph` event, and the state of the graph will be saved in this settings file.\n\n## Events\n\n#### `newClient`\n\nspacebro broadcasts a `newClient` event when a new connection is created, with the client name as `client.name` property value. Typically, you'd do on the client side:\n\n```js\nspacebroClient.on('newClient', (data) =\u003e {\n  console.log(`${data.client.name} has joined.`)\n})\n```\n\n#### `clients`\n\nspacebro broadcasts a `clients` event after a client registered or after\nreceiving a `getClients` event.\n\ndata is an array of clients.\n\n#### `connections`\n\nspacebro broadcasts a `connections` event after a new connection is added or after\nreceiving a `getConnections` event.\n\ndata is an array of connections in the schema descibed below:\n\n```\n{\n  src: {\n    clientName: 'myclient',\n    eventName: 'outMedia'\n  },\n  tgt: {\n    clientName: 'myiotherclient',\n    eventName: 'inMedia'\n  }\n}\n```\n\n\n## Troubleshooting\n\n### ping pong\n\nDo not try to test with `'ping'` and `'pong'` events, those are reserved.\n\n```\n- `ping`. Fired when a ping packet is written out to the server.\n- `pong`. Fired when a pong is received from the server.\n```\n*[source](https://github.com/socketio/socket.io-client/issues/1022)*\n\n## Test\n\n```\nnpm run test\n```\n\n## Contribute\n\nYou can develop on spacebro, by running:\n\n`yarn dev`\n\nyou can build with `yarn build`\n\nWe use galaxies names for our release name, listed here [here](https://en.wikipedia.org/wiki/List_of_galaxies). We are currently at Black Eye.\n\nYou can check the `examples/` folder, as well as the [spacebro-client](https://github.com/soixantecircuits/spacebro-client) examples for real life examples.\n\nPlease follow [standard style](https://github.com/feross/standard) conventions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacebro%2Fspacebro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspacebro%2Fspacebro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacebro%2Fspacebro/lists"}