{"id":18879051,"url":"https://github.com/zhuima/nginx-ws","last_synced_at":"2025-07-28T16:11:16.797Z","repository":{"id":81212749,"uuid":"159907051","full_name":"zhuima/nginx-ws","owner":"zhuima","description":"nginx proxy websocket","archived":false,"fork":false,"pushed_at":"2019-03-20T01:49:26.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-31T06:17:22.875Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zhuima.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-12-01T03:58:12.000Z","updated_at":"2019-03-20T01:49:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"820c5ece-3f16-4c77-8791-85d57c0f72ed","html_url":"https://github.com/zhuima/nginx-ws","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zhuima/nginx-ws","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhuima%2Fnginx-ws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhuima%2Fnginx-ws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhuima%2Fnginx-ws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhuima%2Fnginx-ws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhuima","download_url":"https://codeload.github.com/zhuima/nginx-ws/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhuima%2Fnginx-ws/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267544578,"owners_count":24104792,"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","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"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":[],"created_at":"2024-11-08T06:32:48.861Z","updated_at":"2025-07-28T16:11:16.746Z","avatar_url":"https://github.com/zhuima.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"nginx-ws-demo\n=============\n\n\n[TOC]\n\n\n### 一、nginx负载均衡websocket注意事项\n\n- 和普通代理不一样的地方\n\n```python\nproxy_set_header Upgrade $http_upgrade;\nproxy_set_header Connection \"upgrade\";\n```\n\n### 二、参考文档\n\n[配置 Nginx 反向代理 WebSocket](https://www.hi-linux.com/posts/42176.html)\n\n[神策服务转发配置](https://www.sensorsdata.cn/manual/data_import_nginx.html)\n\n### 三、使用方式\n\n```python\nnpm --registry=https://registry.npm.taobao.org install ws\ncd ws\nnode server.js\n# 如果想实现负载，复制ws目录，然后修改下对应的端口即可\n```\n\n### 四、测试\n\n- npm --registry=https://registry.npm.taobao.org install wscat\n- cd ~/node_modules/wscat/\n- ./bin/wscat --connect ws://yourdomain\n- send message test\n- 查看服务器端的日志\n\n\n### 五、关于ip_hash\n\n- 有些文档表示一定要使用ip_hash，确保数据的有序，但是没有验证\n- 另外就是ip_hash就是统一客户端的请求始终会落到后端的其中一个节点上，所以要特别注意\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhuima%2Fnginx-ws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhuima%2Fnginx-ws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhuima%2Fnginx-ws/lists"}