Skip to content

Commit

Permalink
fix: 修复无法握手 (#15)
Browse files Browse the repository at this point in the history
* test: test

* sv

* fewngo

* 3223

* chore: 加入commit提交规范

* chore: 优化commit规范

* workflow: 增加ci检测及加入pr模板

* fix: 修复pnpm format引起的ci问题

* fix: 修复pnpm lint引起的ci问题

* fix: 修复pnpm lint引起的ci问题

* feat: 初始化websocket客户端

* fix: 修改eslint规则,优化websocket(#6)

* ci: 去除typescript的ci

* refactor: 重构项目,去除typescript

* feat: 加入ws 开发依赖等(#13)

* fix: 修复无法握手,host=>hostName

* fix: 修复无法握手
  • Loading branch information
yuhao423 authored Jun 24, 2024
1 parent 6a28b0c commit 32087c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const YuFlux = require("./websocket");

const yuFlux = new YuFlux("http://localhost:8000");
yuFlux.on("upgrade", (res, socket, head) => {
console.error("res.headers");

yuFlux.on("upgrade", (res) => {
console.error(res.headers, "res.headers");
});
2 changes: 1 addition & 1 deletion src/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const initWebSocketClient = (websocket, address, protocols, options) => {
const defaultPort = isSecure ? 443 : 80;
opts.port = parseUrl.port || defaultPort;
//处理ipv6
opts.host = parseUrl.host.startsWith("[") ? parseUrl.host.slice(1, -1) : parseUrl.host;
opts.host = parseUrl.host.startsWith("[") ? parseUrl.hostName.slice(1, -1) : parseUrl.hostName;
//请求头
opts.headers = {
...opts.headers,
Expand Down

0 comments on commit 32087c3

Please sign in to comment.