{"id":15637722,"url":"https://github.com/bogdanrada/celluloid_pubsub","last_synced_at":"2025-04-30T06:08:19.742Z","repository":{"id":28545933,"uuid":"32063099","full_name":"bogdanRada/celluloid_pubsub","owner":"bogdanRada","description":"CelluloidPubsub is a simple ruby implementation of publish subscribe design patterns using celluloid actors and websockets. ","archived":false,"fork":false,"pushed_at":"2021-04-18T11:59:25.000Z","size":351,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-30T06:08:11.105Z","etag":null,"topics":["async","celluloid","pubsub","reel","ruby","websockets"],"latest_commit_sha":null,"homepage":"","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/bogdanRada.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-12T07:23:56.000Z","updated_at":"2023-03-05T03:02:00.000Z","dependencies_parsed_at":"2022-09-19T20:44:57.166Z","dependency_job_id":null,"html_url":"https://github.com/bogdanRada/celluloid_pubsub","commit_stats":null,"previous_names":[],"tags_count":60,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bogdanRada%2Fcelluloid_pubsub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bogdanRada%2Fcelluloid_pubsub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bogdanRada%2Fcelluloid_pubsub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bogdanRada%2Fcelluloid_pubsub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bogdanRada","download_url":"https://codeload.github.com/bogdanRada/celluloid_pubsub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251651233,"owners_count":21621716,"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":["async","celluloid","pubsub","reel","ruby","websockets"],"created_at":"2024-10-03T11:12:40.795Z","updated_at":"2025-04-30T06:08:19.713Z","avatar_url":"https://github.com/bogdanRada.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"celluloid_pubsub\n================\n\n[![Gem Version](https://badge.fury.io/rb/celluloid_pubsub.svg)](http://badge.fury.io/rb/celluloid_pubsub) [![Build Status](https://travis-ci.org/bogdanRada/celluloid_pubsub.png?branch=master,develop)](https://travis-ci.org/bogdanRada/celluloid_pubsub) [![Coverage Status](https://coveralls.io/repos/bogdanRada/celluloid_pubsub/badge.svg?branch=master)](https://coveralls.io/r/bogdanRada/celluloid_pubsub?branch=master) [![Code Climate](https://codeclimate.com/github/bogdanRada/celluloid_pubsub/badges/gpa.svg)](https://codeclimate.com/github/bogdanRada/celluloid_pubsub) [![Repo Size](https://reposs.herokuapp.com/?path=bogdanRada/celluloid_pubsub)](https://github.com/bogdanRada/celluloid_pubsub) [![Gem Downloads](https://ruby-gem-downloads-badge.herokuapp.com/celluloid_pubsub?type=total\u0026style=dynamic)](https://github.com/bogdanRada/celluloid_pubsub) [![Documentation Status](https://inch-ci.org/github/bogdanRada/celluloid_pubsub.svg?branch=master)](https://inch-ci.org/github/bogdanRada/celluloid_pubsubb) [![Analytics](https://ga-beacon.appspot.com/UA-72570203-1/bogdanRada/celluloid_pubsub)](https://github.com/bogdanRada/celluloid_pubsub)\n\nDescription\n-----------\n\nCelluloidPubsub is a simple ruby implementation of publish subscribe design patterns using celluloid actors and websockets, using Celluloid::Reel server\n\n**Starting with version 0.9.0, the webserver will automatically detect an unused port instead of trying to connect by default to 1234 port. This solves some issues when this port is already used.**\n\nStarting with version 0.7.0, Support for Celluloid 0.17 has been added.\n\nStarting with version 0.6.0, Redis support was moved into gem [celluloid_pubsub_redis_adapter](https://github.com/bogdanRada/celluloid_pubsub_redis_adapter)\n\nRequirements\n------------\n\n1.\t[Ruby 1.9.x or Ruby 2.x.x](http://www.ruby-lang.org)\n2.\t[Celluloid \u003e= 0.16.0](https://github.com/celluloid/celluloid)\n3.\t[Celluloid-IO \u003e= 0.16.2](https://github.com/celluloid/celluloid-io)\n4.\t[Reel \u003e= 0.6.0](https://github.com/celluloid/reel)\n5.\t[Celluloid-websocket-client = 0.0.1](https://github.com/jeremyd/celluloid-websocket-client)\n6.\t[ActiveSuport \u003e= 4.2.0](https://rubygems.org/gems/activesupport)\n\nCompatibility\n-------------\n\nRails \u003e3.0 only. MRI 1.9.x, 2.x, JRuby (--1.9).\n\nRuby 1.8 is not officially supported. We will accept further compatibilty pull-requests but no upcoming versions will be tested against it.\n\nRubinius support temporarily dropped due to Rails 4 incompatibility.\n\nInstallation Instructions\n-------------------------\n\nAdd the following to your Gemfile:\n\n```ruby\n  gem \"celluloid_pubsub\"\n```\n\nPlease read [Release Details](https://github.com/bogdanRada/celluloid_pubsub/releases) if you are upgrading. We break backward compatibility between large ticks but you can expect it to be specified at release notes.\n\nUsage\n-----\n\nCreating a websocket server is simple as doing this. This are all the options available with their default values.\n\n```ruby\nCelluloidPubsub::WebServer.supervise_as(:web_server,\n  enable_debug: true, # if debug messages should be logged\n  adapter: nil ,  # if set to nil, will instantiate a simple Reactor to handle the connections which  has no dependencies . Otherwise will try to use that adapter.  Please see [celluloid_pubsub_redis_adapter](https://github.com/bogdanRada/celluloid_pubsub_redis_adapter) for more details on using redis adapter\n  log_file_path: \"path/to/log_file.log\", # The log file where all debugging information will be printed\n  hostname: \"0.0.0.0\", # the hostname of the server.\n  port: 1234, # the port on which the server will listen for connections\n  path: '/ws', # the relative path used in the URL where connections are allowed to connect\n  spy: false, # whether to spy all internal Websocket connections in order to get more debugging information\n  backlog: 1024 # the number of connections allowed to be connected to the server at a certain time\n )\n```\n\nCreating a client is simple as doing this. If you provide the channel when you initialize the **CelluloidPubsub::Client** it will automatically start the subscription to that channel. But sometimes, you might want to subscribe at a later time, so you can just omit the channel when you initialize the client, and use instead **@client.subscribe('test_channel')**. After the subscription has started, the client must implement the method **on_message** and the **on_close** method (called when client disconnects from the channel). The method **on_message** will receive all incoming messages from the server. You can test if the subscription was successful by doing this **@client.succesfull_subscription?(message)**.\n\n```ruby\nclass MyAwesomeClient\n  include Celluloid\n\n  def initialize(options = {})\n    @client = CelluloidPubsub::Client.new({\n      actor: Actor.current,\n      channel: 'test_channel', # the channel to which this client will subscribe to.\n      log_file_path: \"path/to/log_file.log\", # The log file where all debugging information will be printed\n       hostname: \"0.0.0.0\",  # the hostname of the server.\n       port: 1234,# the port on which the connection will be made to\n       path: '/ws', # the relative path used in the URL where the connection will be connecting to\n       enable_debug: false # if debug messages should be logged\n     }.merge(options))\n  end\n\n  def on_message(message)\n    if @client.succesfull_subscription?(message)\n      puts \"subscriber got successful subscription #{message.inspect}\"\n      @client.publish('test_channel2', 'data' =\u003e ' subscriber got successfull subscription') # the message needs to be a Hash\n    else\n      puts \"subscriber got message #{message.inspect}\"\n    end\n  end\n\n  def on_close(code, reason)\n    puts \"websocket connection closed: #{code.inspect}, #{reason.inspect}\"\n    terminate\n  end\n\n\nend\n\n```\n\nThe methods available that the **CelluloidPubsub::Client** instance can execute are:\n\n-\tsubscribe -- subscribe - accepts a string as a channel name\n-\tpublish - accepts a string as a channel name, and a Hash object\n-\tunsubscribe - accepts a string as a channel_name from which the client will unsubscribe from\n-\tunsubscribe_clients - accepts a string as a channel_name . This will disconnect all clients that are subscribed to that channel.\n-\tunsubscribe_all - This does not have any parameters. Will unsubscribe all clients from all channnels\n-\ton_close - This accepts a code and a reason as parameters. This method will be called when the client disconnects from the channel.\n\nExamples\n--------\n\nPlease check the [Examples Folder](https://github.com/bogdanRada/celluloid_pubsub/tree/master/examples). There you can find some basic examples.\n\nTesting\n-------\n\nTo test, do the following:\n\n1.\tcd to the gem root.\n2.\tbundle install\n3.\tbundle exec rake\n\nContributions\n-------------\n\nPlease log all feedback/issues via [Github Issues](http://github.com/bogdanRada/celluloid_pubsub/issues). Thanks.\n\nContributing to celluloid_pubsub\n--------------------------------\n\n-\tCheck out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.\n-\tCheck out the issue tracker to make sure someone already hasn't requested it and/or contributed it.\n-\tFork the project.\n-\tStart a feature/bugfix branch.\n-\tCommit and push until you are happy with your contribution.\n-\tMake sure to add tests for it. This is important so I don't break it in a future version unintentionally.\n-\tPlease try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.\n\n== Copyright\n\nCopyright (c) 2015 bogdanRada. See LICENSE.txt for further details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbogdanrada%2Fcelluloid_pubsub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbogdanrada%2Fcelluloid_pubsub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbogdanrada%2Fcelluloid_pubsub/lists"}