Thanks to visit codestin.com
Credit goes to github.com

Skip to content

docs: socket.io-auth.js #2340

Closed
jingmingji wants to merge 12 commits into
eggjs:masterfrom
jingmingji:master
Closed

docs: socket.io-auth.js #2340
jingmingji wants to merge 12 commits into
eggjs:masterfrom
jingmingji:master

Conversation

@jingmingji

Copy link
Copy Markdown

官方文档socket.io实例—p2p聊天,中间件auth.js里面socket.join(room)放到了nsp.adapter.clients()里面有问题,导致clients返回到前端无法正常携带当前的socket信息,应该把socket.join(room)放到nsp.adapter.clients()外面先执行,亲测如此可以正常返回clients数据。另外clients[id] = query这个操作和插件本身的操作有冲突,因为socket.join(room)调用成功后,会自动将socketid放入到clients数组里面。如果想添加多余的信息可以通过其他字段来返回,没必要对这个插件会调用的属性进行操作。

jingmingji and others added 10 commits April 8, 2018 15:07
1、socket.join(room)放到了nsp.adapter.clients()里面有问题,导致clients返回到前端无法正常携带当前的socket信息,应该把socket.join(room)放到nsp.adapter.clients()外面先执行,亲测如此可以正常返回clients数据。
2、另外clients[id] = query,这个操作和插件本身的操作有冲突,因为socket.join(room)调用成功后,会自动将socketid放入到clients数组里面。如果想添加多余的信息可以通过其他字段来返回,没必要对这个插件会调用的属性进行操作。
@jingmingji jingmingji changed the title 关于官方文档socket.io部分的纠错 docs:socket.io部分的纠错 Apr 8, 2018
@jingmingji jingmingji changed the title docs:socket.io部分的纠错 docs: socket.io-auth.js Apr 8, 2018
@codecov

codecov Bot commented Apr 8, 2018

Copy link
Copy Markdown

Codecov Report

Merging #2340 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2340   +/-   ##
=======================================
  Coverage   99.61%   99.61%           
=======================================
  Files          29       29           
  Lines         773      773           
=======================================
  Hits          770      770           
  Misses          3        3

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba708ca...568af38. Read the comment docs.

@thonatos

thonatos commented Apr 8, 2018

Copy link
Copy Markdown
Member

#2338

@popomore popomore requested a review from ngot April 11, 2018 16:21
@thonatos

Copy link
Copy Markdown
Member

#2354 更新过了,这边关了,辛苦了

@thonatos thonatos closed this Apr 12, 2018
@koybe

koybe commented Aug 2, 2018

Copy link
Copy Markdown

@thonatos uws的npm包是deprecated的,稳定性怎么样

@thonatos

thonatos commented Aug 3, 2018

Copy link
Copy Markdown
Member

@koybe

很久没用了,不大确定,之前用它是因为在 ff 上兼容性有问题。
既然是 deprecated 了,就用回默认的吧,不过,理论上向下兼容吧?最好测试一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants