{"id":17481210,"url":"https://github.com/paratron/live-data-broker","last_synced_at":"2026-03-19T01:12:42.145Z","repository":{"id":141688128,"uuid":"317974157","full_name":"Paratron/live-data-broker","owner":"Paratron","description":"A websocket based push service for traditional request-based APIs like REST","archived":false,"fork":false,"pushed_at":"2020-12-02T19:50:48.000Z","size":1,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-19T01:18:44.197Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/Paratron.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-02T19:50:19.000Z","updated_at":"2022-11-26T07:20:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"46d23027-4c8e-4367-9ddb-02dd923b5f22","html_url":"https://github.com/Paratron/live-data-broker","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"6f5c341fec18c904253b126f2cd5849bb52977d4"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Paratron%2Flive-data-broker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Paratron%2Flive-data-broker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Paratron%2Flive-data-broker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Paratron%2Flive-data-broker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Paratron","download_url":"https://codeload.github.com/Paratron/live-data-broker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246034299,"owners_count":20712857,"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":"2024-10-18T22:08:55.301Z","updated_at":"2026-01-28T04:10:51.615Z","avatar_url":"https://github.com/Paratron.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Live Data Broker\n\n## Motivation\nIn order to deliver live data without having many clients constantly polling from our API endpoints and causing high\nsystem load, it would be great to be able to push updates to all website visitors.\n\n## Concept\nThe broker works as a middleman between a traditional pull based API and turns it into a websocket service which broadcasts\ndata to many clients.\n\nClients may subscribe callbacks to different endpoints. Whenever new data arrives from the broker, the callback is called.\nAn endpoint is identified with a string. The string may include a dynamic part like an identifier.  \n\n### Clientside Example\n```typescript\nimport liveClient from \"live-data-broker/client\";\n\nliveClient.subscribe(\"game/12\", (data) =\u003e {\n    console.log(data);\n});\n```\n\nServerside, the `publish` function is being called to create endpoints where clients can subscribe to. The provided callback\nwill be called when the first client subscribes to the endpoint. The callback sets up periodical data fetching and calls the `update`\nmethod with fresh data. When the data has changed since the last broadcast, an update will be issued. The callback needs to return another\ncallback that is executed when the last client stopped observing the endpoint and cleans up any intervals or other data fetching.\n\nWhen a new client subscribes to the endpoint again at a later time, the setup callback will be called again, re-enabling the data fetching.\n\n### Serverside Example\n```typescript\nconst fetch = require(\"node-fetch\");\nconst broker = require(\"live-data-broker/server\");\n\nbroker.publish(\"game/[id]\", ({id}, update) =\u003e {\n    const interval = setInterval(() =\u003e {\n        fetch(`https://example.com/api/games/${id}`).then(update);\n    }, 5000);\n    \n    return () =\u003e {\n        clearInterval(interval);\n    }   \n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparatron%2Flive-data-broker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparatron%2Flive-data-broker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparatron%2Flive-data-broker/lists"}