{"id":15430899,"url":"https://github.com/y-crdt/yrb-actioncable","last_synced_at":"2025-04-15T02:19:20.192Z","repository":{"id":62157780,"uuid":"543571286","full_name":"y-crdt/yrb-actioncable","owner":"y-crdt","description":"An ActionCable companion for Y.js clients.","archived":false,"fork":false,"pushed_at":"2025-04-01T23:25:26.000Z","size":9192,"stargazers_count":55,"open_issues_count":10,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-15T02:19:11.146Z","etag":null,"topics":["actioncable","crdt","rails","ruby","websocket"],"latest_commit_sha":null,"homepage":"https://y-crdt.github.io/yrb-actioncable/","language":"Ruby","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/y-crdt.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-30T11:37:05.000Z","updated_at":"2025-04-03T12:50:08.000Z","dependencies_parsed_at":"2022-10-27T13:31:48.981Z","dependency_job_id":"c95d91e2-58af-49db-baec-f69ef7640375","html_url":"https://github.com/y-crdt/yrb-actioncable","commit_stats":{"total_commits":52,"total_committers":3,"mean_commits":"17.333333333333332","dds":0.3076923076923077,"last_synced_commit":"d307c33fede8fad0f572b7724e4b799192eaad0b"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-crdt%2Fyrb-actioncable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-crdt%2Fyrb-actioncable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-crdt%2Fyrb-actioncable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-crdt%2Fyrb-actioncable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/y-crdt","download_url":"https://codeload.github.com/y-crdt/yrb-actioncable/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248991558,"owners_count":21194894,"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":["actioncable","crdt","rails","ruby","websocket"],"created_at":"2024-10-01T18:19:28.032Z","updated_at":"2025-04-15T02:19:20.167Z","avatar_url":"https://github.com/y-crdt.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Yrb\" src=\"./docs/assets/logo.png\" width=\"300\" /\u003e\n\u003c/p\u003e\n\n---\n\n# yrb-actioncable\n\n\u003e An ActionCable companion for Y.js clients\n\nThis project provides you with the necessary JavaScript and Ruby dependencies to\nset up a reliable WebSocket connection between many\n[Y.js](https://github.com/yjs/yjs) clients and a Ruby on Rails server, using\nstandard Rails [ActionCable](https://guides.rubyonrails.org/action_cable_overview.html)\n[channels](https://guides.rubyonrails.org/action_cable_overview.html#terminology-channels).\n\nThe project is organized as a monorepo with [npm modules](./packages) and\n[Ruby gems](./gems). Please check the respective sub-repos and\n[documentation](https://y-crdt.github.io/yrb-actioncable/) for detailed\ninformation. \n\n## Usage\n\nInstall gem and npm package:\n\n```\ngem install y-rb_actioncable\nyarn add @y-rb/actioncable\n```\n\n### Example\n\nCreate a Rails channel that includes the Sync module:\n\n```ruby\n# app/channels/sync_channel.rb\nclass SyncChannel \u003c ApplicationCable::Channel\n  include Y::Actioncable::Sync\n\n  def subscribed\n    # initiate sync \u0026 subscribe to updates, with optional persistence mechanism\n    sync_for(session)\n  end\n\n  def receive(message)\n    # broadcast update to all connected clients on all servers\n    sync_to(session, message)\n  end\nend\n```\n\nCreate a client and bind to an instance of the [tiptap](https://tiptap.dev/)\neditor:\n\n```typescript\nimport {WebsocketProvider} from \"@y-rb/actioncable\";\nimport { createConsumer } from \"@rails/actioncable\";\n\nconst document = new Y.Doc();\nconst consumer = createConsumer();\n\nconst provider = new WebsocketProvider(\n  document,\n  consumer,\n  \"SyncChannel\",\n  {id: \"1\"}\n);\n\nnew Editor({\n  element: document.querySelector(\"#editor\"),\n  extensions: [\n    StarterKit.configure({history: false}),\n    Collaboration.configure({document}),\n    CollaborationCursor.configure({\n      provider,\n      user: {name: \"Hannes\", color: \"#ff0000\"}\n    })\n  ]\n});\n```\n\n## Development\n\nMake sure you have Ruby and Node.js w/ yarn installed. We recommend to manage\nruntimes with [asdf](https://asdf-vm.com/).\n\n`yrb-actioncable` is a mix of Ruby and JavaScript repositories. The JavaScript\nrepositories are manged with [turbo](https://turbo.build/repo).\nAfter you have successfully run `yarn` in the repository root, _turbo_ will be\navailable and can be used to build packages.\n\n### JavaScript\n\n```bash\nyarn\nyarn lint:fix     # lint and autocorrect violations\nyarn turbo build  # build npm package\n```\n\nReleasing a new version of an npm module is easy. We use\n[changesets](https://github.com/changesets/changesets/blob/main/docs/intro-to-using-changesets.md)\nto make it really simple:\n\n```bash\n# Add a new changeset\nchangeset\n\n# Create new versions of packages\nchangeset version\n\n# Commit and push to main\n# GitHub Action will automatically create a tag, a GitHub release entry, build\n# and publish the package to npmjs.com. The GitHub Action runs`yarn release`.\n```\n\nIf you need to create a new package, please use [tsdx](https://tsdx.io/) for\nsetup. It removes a lot of the setup pain, and creates correct builds for\nmany targets (Node.js, ECMAScript Modules, AMD, …).\n\n### Ruby\n\nRuby development is less automated. You **cannot** use `turbo` commands to build\nthe `gem`, isntead you need to manually build and release Ruby gems. All gems\nin the `./gems` directory where created using the standard method described on\n[rubygems.org](https://guides.rubygems.org/make-your-own-gem/).\n\n```\ncd gems/yrb-actioncable\nbundle\nrake spec\nrake build                                    # y-rb_actioncable 0.1.5 built to pkg/y-rb_actioncable-0.1.5.gem\ncd pkg \u0026\u0026 gem push y-rb_actioncable-0.1.5.gem # release new version on rubygems.org\n```\n\nThe documentation for a gem is automatically generated and published every time\na PR gets merged into `main`. You can find the documentation here:\nhttps://y-crdt.github.io/yrb-actioncable/\n\nThe [sandbox environment](./examples/collaborative-text-editor) and running\nRedis specific specs in [./gems/yrb-actioncable](./gems/yrb-actioncable) require\nRedis. We use Docker to run the Redis server.\n\n## Contributing\n\nContributions are welcome. Be nice to people, and follow the following rules.\n\n1. PRs must be rebased, no merge requests allowed (clean history)\n2. Commit messages must adhere to this [convention](https://github.com/angular/angular/blob/main/CONTRIBUTING.md#commit)\n\n## License\n\nThe gem is available as *open source* under the terms of the\n[MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fy-crdt%2Fyrb-actioncable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fy-crdt%2Fyrb-actioncable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fy-crdt%2Fyrb-actioncable/lists"}