{"id":50968107,"url":"https://github.com/ratopi/websocket-cowboy-experiments","last_synced_at":"2026-06-18T22:33:00.046Z","repository":{"id":342832814,"uuid":"996389459","full_name":"ratopi/websocket-cowboy-experiments","owner":"ratopi","description":"WebSocketCowboyGunExperiments","archived":false,"fork":false,"pushed_at":"2026-03-07T15:35:37.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-07T21:46:55.862Z","etag":null,"topics":["cowboy","erlang","gun","websocket"],"latest_commit_sha":null,"homepage":"","language":"Erlang","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/ratopi.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-04T22:08:29.000Z","updated_at":"2026-03-07T15:35:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ratopi/websocket-cowboy-experiments","commit_stats":null,"previous_names":["ratopi/websocket-cowboy-experiments"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ratopi/websocket-cowboy-experiments","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ratopi%2Fwebsocket-cowboy-experiments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ratopi%2Fwebsocket-cowboy-experiments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ratopi%2Fwebsocket-cowboy-experiments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ratopi%2Fwebsocket-cowboy-experiments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ratopi","download_url":"https://codeload.github.com/ratopi/websocket-cowboy-experiments/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ratopi%2Fwebsocket-cowboy-experiments/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34510286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cowboy","erlang","gun","websocket"],"created_at":"2026-06-18T22:32:59.799Z","updated_at":"2026-06-18T22:33:00.035Z","avatar_url":"https://github.com/ratopi.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WebSocket-Cowboy-Gun-Experiments\n\nA minimal Erlang/OTP playground for WebSocket communication using [Cowboy](https://github.com/ninenines/cowboy) (server) and [Gun](https://github.com/ninenines/gun) (client).\n\n## What is this?\n\nThis project demonstrates how to set up a WebSocket server and client in Erlang using the Cowboy/Gun ecosystem from Nine Nines. It consists of two independent OTP applications:\n\n- **`wss/`** – WebSocket **server** built with Cowboy. Accepts WebSocket connections on `/ws`, sends a welcome message, echoes text frames back, and handles ping/pong.\n- **`wsc/`** – WebSocket **client** built with Gun. Connects to the server asynchronously, sends periodic pings, and logs received messages.\n\n## Prerequisites\n\n- Erlang/OTP 25+\n- [rebar3](https://rebar3.org/)\n\n## Usage\n\n**1. Start the server:**\n\n```sh\ncd wss\nrebar3 shell\n```\n\nThe server listens on port `10101` by default (configurable via `application:set_env(wss, port, 12345)`).\n\n**2. Start the client** (in a separate shell):\n\n```sh\ncd wsc\nrebar3 shell\n```\n\nThe client connects to `localhost:10101` by default. Host and port are configurable:\n\n```erlang\napplication:set_env(wsc, host, \"example.com\").\napplication:set_env(wsc, port, 12345).\n```\n\n## Configuration\n\nBoth apps read their settings from the OTP application environment:\n\n| App   | Key    | Default       | Description                |\n|-------|--------|---------------|----------------------------|\n| `wss` | `port` | `10101`       | Server listen port         |\n| `wsc` | `host` | `\"localhost\"` | Server hostname to connect |\n| `wsc` | `port` | `10101`       | Server port to connect     |\n\n## Project Structure\n\n```\n├── wss/          WebSocket server (Cowboy)\n│   └── src/\n│       ├── wss_app.erl       Application entry point\n│       ├── wss_sup.erl       Supervisor\n│       ├── wss_cowboy.erl    Cowboy listener setup\n│       └── wss_ws.erl        WebSocket handler\n│\n├── wsc/          WebSocket client (Gun)\n│   └── src/\n│       ├── wsc_app.erl       Application entry point\n│       ├── wsc_sup.erl       Supervisor\n│       └── wsc_client.erl    gen_server with async WebSocket client\n```\n\n## License\n\nMIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fratopi%2Fwebsocket-cowboy-experiments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fratopi%2Fwebsocket-cowboy-experiments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fratopi%2Fwebsocket-cowboy-experiments/lists"}