{"id":14989368,"url":"https://github.com/kudos/koa-websocket","last_synced_at":"2025-10-08T01:07:02.872Z","repository":{"id":28355608,"uuid":"31869386","full_name":"kudos/koa-websocket","owner":"kudos","description":"Light wrapper around Koa providing a websocket middleware handler that is koa-route compatible.","archived":false,"fork":false,"pushed_at":"2023-02-27T07:56:31.000Z","size":846,"stargazers_count":260,"open_issues_count":22,"forks_count":38,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-04T02:09:11.932Z","etag":null,"topics":["javascript","koa","nodejs","websockets","ws"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/kudos.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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":"2015-03-08T23:03:44.000Z","updated_at":"2025-03-12T08:29:40.000Z","dependencies_parsed_at":"2024-06-18T12:36:25.501Z","dependency_job_id":"3797c4eb-4a2b-460d-a65c-b6bed7a31d85","html_url":"https://github.com/kudos/koa-websocket","commit_stats":{"total_commits":89,"total_committers":9,"mean_commits":9.88888888888889,"dds":0.5617977528089888,"last_synced_commit":"99289c86bbc839b102d5a7e3be663a6af7d6a843"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kudos%2Fkoa-websocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kudos%2Fkoa-websocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kudos%2Fkoa-websocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kudos%2Fkoa-websocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kudos","download_url":"https://codeload.github.com/kudos/koa-websocket/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248646806,"owners_count":21139077,"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":["javascript","koa","nodejs","websockets","ws"],"created_at":"2024-09-24T14:18:13.498Z","updated_at":"2025-10-08T01:06:57.834Z","avatar_url":"https://github.com/kudos.png","language":"JavaScript","readme":"# koa-websocket\n\n[![CI Status](https://github.com/kudos/koa-websocket/actions/workflows/node.js.yml/badge.svg)](https://github.com/kudos/koa-websocket/actions)\n\n\u003e Koa v2 is now the default. For Koa v1 support install with koa-websocket@2 and see the `legacy` branch.\n\nSupports `ws://` and `wss://`\n\n## Installation\n\n`npm install koa-websocket`\n\n## Usage\n\nSee examples directory for a simple implementation.\n\n### Let's Encrypt\n\nExample with Let's Encrypt ([the Greenlock package](https://git.daplie.com/Daplie/greenlock-koa)):\n\n```js\nconst Koa = require('koa');\nconst greenlock = require('greenlock-express');\nconst websockify = require('koa-websocket');\n \nconst le = greenlock.create({\n  // all your sweet Let's Encrypt options here\n});\n \n// the magic happens right here\nconst app = websockify(new Koa(), wsOptions, le.httpsOptions);\n \napp.ws.use((ctx) =\u003e {\n   // the websocket is added to the context as `ctx.websocket`.\n  ctx.websocket.on('message', function(message) {\n    // do something\n  });\n});\n \napp.listen(3000);\n```\n\n## API\n#### websockify(KoaApp, [WebSocketOptions], [httpsOptions])\nThe WebSocket options object just get passed right through to the `new WebSocketServer(options)` call.\n\nThe optional HTTPS options object gets passed right into `https.createServer(options)`. If the HTTPS options are \npassed in, koa-websocket will use the built-in Node HTTPS server to provide support for the `wss://` protocol.\n\n## License\nMIT\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkudos%2Fkoa-websocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkudos%2Fkoa-websocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkudos%2Fkoa-websocket/lists"}