{"id":19594112,"url":"https://github.com/seriousben/socket.io-raft","last_synced_at":"2025-02-26T14:20:17.240Z","repository":{"id":57365193,"uuid":"160101664","full_name":"seriousben/socket.io-raft","owner":"seriousben","description":"Work-In-Progress - Adapter to enable broadcasting of events to multiple separate socket.io server nodes without third-party dependencies.","archived":false,"fork":false,"pushed_at":"2018-12-02T22:45:42.000Z","size":62,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-14T13:57:18.829Z","etag":null,"topics":["raft","raft-consensus-algorithm","socket-io","socket-io-adapter","websocket"],"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/seriousben.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":"2018-12-02T22:15:14.000Z","updated_at":"2019-04-18T00:25:05.000Z","dependencies_parsed_at":"2022-09-12T03:10:55.253Z","dependency_job_id":null,"html_url":"https://github.com/seriousben/socket.io-raft","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriousben%2Fsocket.io-raft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriousben%2Fsocket.io-raft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriousben%2Fsocket.io-raft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriousben%2Fsocket.io-raft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seriousben","download_url":"https://codeload.github.com/seriousben/socket.io-raft/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240867750,"owners_count":19870469,"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":["raft","raft-consensus-algorithm","socket-io","socket-io-adapter","websocket"],"created_at":"2024-11-11T08:42:19.232Z","updated_at":"2025-02-26T14:20:17.158Z","avatar_url":"https://github.com/seriousben.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# socket.io-raft\n\n[![NPM version](https://badge.fury.io/js/socket.io-raft.svg)](http://badge.fury.io/js/socket.io-raft)\n\nAdapter to enable broadcasting of events to multiple separate socket.io server nodes without third-party dependencies.\n\nThis adapter leverages the [Raft](https://ramcloud.stanford.edu/raft.pdf) consensus algorithm to broadcast messages around.\n\n**No need to manage a Redis cluster only for websockets!**\n\n## How to use\n\n```js\nconst io = require('socket.io')(3000);\nconst raftAdapter = require('socket.io-raft');\n// Setup a three node raft cluster (localhost:8000 to localhost:8002)\nio.adapter(raftAdapter({ port: 8000, peers: ['tcp://localhost:8001', 'tcp://localhost:8002'] }));\n```\n\nBy running socket.io with the `socket.io-raft` adapter you can run\nmultiple socket.io instances in different processes or servers that can\nall broadcast and emit events to and from each other.\n\nSo any of the following commands:\n\n```js\nio.emit('hello', 'to all clients');\nio.to('room42').emit('hello', \"to all clients in 'room42' room\");\n\nio.on('connection', (socket) =\u003e {\n  socket.broadcast.emit('hello', 'to all clients except sender');\n  socket.to('room42').emit('hello', \"to all clients in 'room42' room except sender\");\n});\n```\n\nwill properly be broadcast to the clients using the Raft Concensus protocol.\n\n## API\n\nTo be documented.\n\n## TODO\n\n- [x] Broadcast support\n- [ ] Room support\n- [ ] Robustness\n- [ ] Persistent rooms leveraging the Raft log\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseriousben%2Fsocket.io-raft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseriousben%2Fsocket.io-raft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseriousben%2Fsocket.io-raft/lists"}