{"id":15288024,"url":"https://github.com/bunopnu/fresh","last_synced_at":"2025-04-13T05:34:51.039Z","repository":{"id":193727588,"uuid":"687716014","full_name":"bunopnu/fresh","owner":"bunopnu","description":"WebSocket client for Elixir, built atop the Mint ecosystem","archived":false,"fork":false,"pushed_at":"2024-04-13T04:11:02.000Z","size":82,"stargazers_count":31,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-07-08T09:34:59.504Z","etag":null,"topics":["elixir","mint","websocket","websocket-client"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/fresh","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/bunopnu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2023-09-05T21:20:51.000Z","updated_at":"2024-07-05T14:23:25.000Z","dependencies_parsed_at":"2023-09-09T17:52:39.436Z","dependency_job_id":"979f0093-a5a8-4314-a391-25b8ec0f87db","html_url":"https://github.com/bunopnu/fresh","commit_stats":null,"previous_names":["bunopnu/fresh"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bunopnu%2Ffresh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bunopnu%2Ffresh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bunopnu%2Ffresh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bunopnu%2Ffresh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bunopnu","download_url":"https://codeload.github.com/bunopnu/fresh/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670516,"owners_count":21142896,"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","mint","websocket","websocket-client"],"created_at":"2024-09-30T15:43:51.149Z","updated_at":"2025-04-13T05:34:50.763Z","avatar_url":"https://github.com/bunopnu.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fresh\n\nFresh is an attempt to create a simple, reliable and flexible WebSocket client built atop the [Mint](https://github.com/elixir-mint) ecosystem 🌱\n\n\u003cdiv\u003e\n\n\u003cimg src='https://github.com/bunopnu/fresh/actions/workflows/test.yml/badge.svg' alt='Test Status' /\u003e \n\u003cimg src='https://coveralls.io/repos/github/bunopnu/fresh/badge.svg' alt='Coverage Status' /\u003e\n\u003cimg src='https://img.shields.io/hexpm/v/fresh.svg' alt='Hex' /\u003e\n\n\u003c/div\u003e\n\n## Why Fresh?\n\nDiscover the reasons behind choosing Fresh over existing libraries, summed up in three key aspects:\n\n- Simplicity\n- Resilience\n- Control\n\n### Simplicity\n\nFresh is designed with simplicity in mind, offering a user-friendly API that includes clear examples and comprehensive documentation.\n\n### Resilience\n\nFresh drew significant inspiration from Redix, particularly in terms of resilience. By default, Fresh promptly re-establishing the connection when the server terminates the connection or encounters any connectivity issues. When used alongside Supervisor, Fresh delivers exceptional reliability.\n\n### Control\n\nWith Fresh, you gain extensive control over the flow of WebSocket connections, including control over resilience. You can manage scenarios requiring reconnection, identify those that should be ignored, specify when to gracefully terminate a connection, and even instruct Supervisor to restart your process as needed. Additionally, Fresh allows you to leverage custom `Mint.WebSocket` options, transport layer options, custom headers, and more, providing you with the flexibility you require.\n\n## Installation\n\nPackage can be installed by adding `fresh` to your list of dependencies in `mix.exs`:\n\n```elixir\ndefp deps do\n  [\n    {:fresh, \"~\u003e 0.4.4\"}\n  ]\nend\n```\n\n### Compatibility\n\nThis library is well-tested with the following versions of Elixir and Erlang/OTP:\n\n- Elixir 1.14 or newer\n- Erlang/OTP 25 or newer\n\nWhile it may also work with older versions, we strongly recommend using the specified minimum versions for the best experience.\n\n## Example\n\nBelow is an example of a WebSocket client that handles incoming frames to implement a simple counter:\n\n_It is worth mentioning that this example module contains approximately 15 lines of code._\n\n```elixir\ndefmodule EchoWebSocket do\n  use Fresh\n\n  def handle_connect(_status, _headers, _state) do\n    IO.puts(\"Start counting from 0\")\n    {:reply, {:text, \"1\"}, 0}\n  end\n\n  def handle_in({:text, number}, _state) do\n    number = String.to_integer(number)\n\n    IO.puts(\"Number: #{number}\")\n    {:reply, {:text, \"#{number + 1}\"}, number}\n  end\nend\n```\n\nYou can find more examples inside the [examples/](https://github.com/bunopnu/fresh/tree/main/examples) folder.\n\n## Documentation\n\nFor in-depth information and a detailed API reference, please consult the [HexDocs](https://hexdocs.pm/fresh).\n\n## License\n\nFresh is licensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbunopnu%2Ffresh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbunopnu%2Ffresh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbunopnu%2Ffresh/lists"}