{"id":17492932,"url":"https://github.com/chugunov/socketio_emitter","last_synced_at":"2025-04-22T22:20:54.469Z","repository":{"id":45049989,"uuid":"96124050","full_name":"chugunov/socketio_emitter","owner":"chugunov","description":"socketio_emitter allows you to communicate with socket.io servers easily from Elixir processes.","archived":false,"fork":false,"pushed_at":"2022-01-12T14:48:51.000Z","size":25,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-17T13:32:38.800Z","etag":null,"topics":["elixir","emitter","msgpack","redix","socket-io","socket-io-client"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/chugunov.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":"2017-07-03T15:15:02.000Z","updated_at":"2023-12-19T17:31:38.000Z","dependencies_parsed_at":"2022-08-25T15:51:38.432Z","dependency_job_id":null,"html_url":"https://github.com/chugunov/socketio_emitter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chugunov%2Fsocketio_emitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chugunov%2Fsocketio_emitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chugunov%2Fsocketio_emitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chugunov%2Fsocketio_emitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chugunov","download_url":"https://codeload.github.com/chugunov/socketio_emitter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249840736,"owners_count":21332934,"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":["elixir","emitter","msgpack","redix","socket-io","socket-io-client"],"created_at":"2024-10-19T11:07:59.372Z","updated_at":"2025-04-22T22:20:54.443Z","avatar_url":"https://github.com/chugunov.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# socketio_emitter\n\n[![Build Status](https://api.travis-ci.org/chugunov/socketio_emitter.svg?branch=master)](https://travis-ci.org/chugunov/socketio_emitter)\n[![Hex.pm](https://img.shields.io/hexpm/v/socketio_emitter.svg)](https://hex.pm/packages/socketio_emitter)\n\n`socketio_emitter` allows you to communicate with socket.io servers easily from Elixir processes. Inspired by [socket.io-emitter](https://github.com/socketio/socket.io-emitter)\n\n## Installation\n\nThe package can be installed\nby adding `socketio_emitter` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [{:socketio_emitter, \"~\u003e 0.1.2\"}]\nend\n```\n\n## How to use\n\nRegister `socketio_emitter` supervisor at your supervisor tree:\n\n```elixir\ndefmodule ExampleApp do\n  use Application\n\n  def start(_type, _args) do\n    import Supervisor.Spec\n\n    children = [\n      # Add this line to your supervisor tree\n      supervisor(SocketIOEmitter, []),\n    ]\n\n    opts = [strategy: :one_for_one, name: ExampleApp.Supervisor]\n    Supervisor.start_link(children, opts)\n  end\nend\n```\n\nThen call `SocketIOEmitter.emit/2`:\n\n```elixir\nmsg = %{:text =\u003e \"hello\"}\n\n# sending to all clients\n{:ok, _consumers_count} =  SocketIOEmitter.emit [\"broadcast\", msg]\n\n# sending to all clients in 'game' room\n{:ok, _consumers_count} =  SocketIOEmitter.emit [\"new-game\", msg],\n  rooms: [\"game\"]\n  \n# sending to individual socketid (private message)\n{:ok, _consumers_count} =  SocketIOEmitter.emit [\"private\", msg],\n  rooms: [socket_id]\n  \n# sending to all clients in 'admin' namespace\n{:ok, _consumers_count} =  SocketIOEmitter.emit [\"namespace\", msg],\n  nsp: \"/admin\"\n  \n# sending to all clients in 'admin' namespace and in 'notifications' room\n{:ok, _consumers_count} =  SocketIOEmitter.emit [\"namespace\", msg],\n  nsp: \"/admin\",\n  rooms: [\"notifications\"]\n```\n\n## Configuration\n\nYou can configure `socketio_emitter` from your `config.exs`. \nSee the [redix documentation](https://hexdocs.pm/redix/Redix.html#start_link/2) for the possible values of `redix_config`.\n\n```elixir\nuse Mix.Config\n\nconfig :socketio_emitter, :redix_pool,\n  redix_config: [\n    # default value: localhost\n    host: \"example.com\",\n    # default value: 6379\n    port: 5000,\n  ],\n  # 5 Redix processes will be available (default value: 1)\n  pool_size: 5\n```\nOr passing by parameters directly to supervisor, in this way values from config will be **overridden**:\n\n```elixir\nredix_pool = [redix_config: [\n    host: \"localhost\",\n    port: 6379\n  ], pool_size: 3]\n\nchildren = [\n  # Add this line to your supervisor tree\n  supervisor(SocketIOEmitter, [redix_pool], [name: :socket_emitter])\n]\n```\n\n## TODO\n\n- tests\n- documentation\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchugunov%2Fsocketio_emitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchugunov%2Fsocketio_emitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchugunov%2Fsocketio_emitter/lists"}